CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #=============================================================================
  2. # Copyright 2009 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. cmake_minimum_required(VERSION 2.7)
  12. project(VerifyFortranC C Fortran)
  13. option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)
  14. if(VERIFY_CXX)
  15. enable_language(CXX)
  16. set(VerifyCXX VerifyCXX.cxx)
  17. add_definitions(-DVERIFY_CXX)
  18. endif()
  19. include(FortranCInterface)
  20. FortranCInterface_HEADER(VerifyFortran.h SYMBOLS VerifyFortran)
  21. include_directories(${VerifyFortranC_BINARY_DIR})
  22. add_library(VerifyFortran STATIC VerifyFortran.f)
  23. add_executable(VerifyFortranC main.c VerifyC.c ${VerifyCXX})
  24. target_link_libraries(VerifyFortranC VerifyFortran)
  25. if(NOT VERIFY_CXX)
  26. # The entry point (main) is defined in C; link with the C compiler.
  27. set_property(TARGET VerifyFortranC PROPERTY LINKER_LANGUAGE C)
  28. endif()