2004-08-26 22:55:55 +04:00
|
|
|
PROJECT(testf Fortran)
|
2004-09-27 21:03:36 +04:00
|
|
|
SET(CMAKE_VERBOSE_MAKEFILE 1)
|
2004-09-09 01:53:52 +04:00
|
|
|
MESSAGE("ENV_FLAGS = $ENV{FFLAGS}")
|
|
|
|
MESSAGE("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}")
|
|
|
|
MESSAGE("CMAKE_Fortran_COMPILER_FULLPATH = ${CMAKE_Fortran_COMPILER_FULLPATH}")
|
|
|
|
MESSAGE("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}")
|
|
|
|
MESSAGE("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
|
2004-08-06 23:05:00 +04:00
|
|
|
ADD_EXECUTABLE(testf hello.f)
|
2005-02-15 17:01:14 +03:00
|
|
|
|
2007-12-29 06:53:34 +03:00
|
|
|
SET(TEST_MODULE_DEPENDS 0)
|
2005-04-06 23:06:08 +04:00
|
|
|
IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
|
2005-02-15 17:01:14 +03:00
|
|
|
ADD_EXECUTABLE(test_module
|
|
|
|
test_module_main.f90
|
|
|
|
test_module_implementation.f90
|
|
|
|
test_module_interface.f90)
|
2007-10-10 17:09:09 +04:00
|
|
|
|
|
|
|
ADD_EXECUTABLE(test_use_in_comment_fixedform
|
|
|
|
test_use_in_comment_fixedform.f)
|
|
|
|
ADD_EXECUTABLE(test_use_in_comment_freeform
|
|
|
|
test_use_in_comment_freeform.f90)
|
|
|
|
|
|
|
|
ADD_EXECUTABLE(test_in_interface
|
|
|
|
in_interface/main.f90
|
|
|
|
in_interface/module.f90)
|
|
|
|
|
2007-12-31 00:11:38 +03:00
|
|
|
SET(TEST_MODULE_DEPENDS 1)
|
2007-12-29 06:53:34 +03:00
|
|
|
ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
|
|
|
|
|
|
|
|
IF(TEST_MODULE_DEPENDS)
|
2007-12-28 19:50:29 +03:00
|
|
|
# Build the external project separately using a custom target.
|
|
|
|
# Make sure it uses the same build configuration as this test.
|
|
|
|
IF(CMAKE_CONFIGURATION_TYPES)
|
|
|
|
SET(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
|
|
|
|
ELSE(CMAKE_CONFIGURATION_TYPES)
|
|
|
|
SET(External_CONFIG_TYPE)
|
|
|
|
ENDIF(CMAKE_CONFIGURATION_TYPES)
|
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ${testf_BINARY_DIR}/ExternalProject
|
|
|
|
COMMAND ${CMAKE_CTEST_COMMAND}
|
|
|
|
ARGS ${External_CONFIG_TYPE}
|
|
|
|
--build-and-test
|
|
|
|
${testf_SOURCE_DIR}/External
|
|
|
|
${testf_BINARY_DIR}/External
|
|
|
|
--build-noclean
|
|
|
|
--build-two-config
|
|
|
|
--build-project ExtFort
|
|
|
|
--build-generator ${CMAKE_GENERATOR}
|
|
|
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
|
|
|
--build-options -DCMAKE_Fortran_COMPILER:STRING=${CMAKE_Fortran_COMPILER}
|
|
|
|
-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}
|
|
|
|
-DCMAKE_Fortran_FLAGS_DEBUG:STRING=${CMAKE_Fortran_FLAGS_DEBUG}
|
|
|
|
-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}
|
|
|
|
-DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL}
|
|
|
|
-DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}
|
|
|
|
)
|
|
|
|
ADD_CUSTOM_TARGET(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject)
|
|
|
|
|
2007-12-31 00:11:38 +03:00
|
|
|
# Test module output directory if available.
|
|
|
|
IF(CMAKE_Fortran_MODDIR_FLAG)
|
|
|
|
SET(Library_MODDIR "${testf_BINARY_DIR}/Library/modules")
|
|
|
|
ELSE(CMAKE_Fortran_MODDIR_FLAG)
|
|
|
|
SET(Library_MODDIR "${testf_BINARY_DIR}/Library")
|
|
|
|
ENDIF(CMAKE_Fortran_MODDIR_FLAG)
|
|
|
|
|
2007-12-15 23:36:14 +03:00
|
|
|
ADD_SUBDIRECTORY(Library)
|
2007-12-28 19:50:29 +03:00
|
|
|
ADD_SUBDIRECTORY(Executable)
|
2007-12-29 06:53:34 +03:00
|
|
|
ENDIF(TEST_MODULE_DEPENDS)
|