diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-10-11 15:16:57 +0900 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-10-11 15:16:57 +0900 |
commit | 915c76ded744c0f5f151402b9fa69f3fd8452573 (patch) | |
tree | ca6a387466543248890f346847acaa8343989b22 /Tests/Fortran | |
parent | 317dbdb79761ef65e45c7358cfc7571c6afa54ad (diff) | |
download | cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.gz cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.bz2 cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.zip |
Imported Upstream version 3.9.4upstream/3.9.4
Diffstat (limited to 'Tests/Fortran')
-rw-r--r-- | Tests/Fortran/CMakeLists.txt | 105 | ||||
-rw-r--r-- | Tests/Fortran/Executable/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/Fortran/Executable/main.f90 | 6 | ||||
-rw-r--r-- | Tests/Fortran/External/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/Fortran/External/a.f90 | 7 | ||||
-rw-r--r-- | Tests/Fortran/Library/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/Fortran/Library/a.f90 | 3 | ||||
-rw-r--r-- | Tests/Fortran/Library/b.f90 | 2 | ||||
-rw-r--r-- | Tests/Fortran/Library/main.f90 | 3 | ||||
-rw-r--r-- | Tests/Fortran/in_interface/main.f90 | 3 | ||||
-rw-r--r-- | Tests/Fortran/in_interface/module.f90 | 12 | ||||
-rw-r--r-- | Tests/Fortran/include/test_preprocess.h | 5 | ||||
-rw-r--r-- | Tests/Fortran/test_module_implementation.f90 | 6 | ||||
-rw-r--r-- | Tests/Fortran/test_module_interface.f90 | 9 | ||||
-rw-r--r-- | Tests/Fortran/test_module_main.f90 | 4 | ||||
-rw-r--r-- | Tests/Fortran/test_preprocess.F90 | 51 | ||||
-rw-r--r-- | Tests/Fortran/test_use_in_comment_fixedform.f | 7 | ||||
-rw-r--r-- | Tests/Fortran/test_use_in_comment_freeform.f90 | 7 |
18 files changed, 13 insertions, 240 deletions
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index cda5fed3f..740e6f594 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,5 +1,6 @@ -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required (VERSION 3.1) project(testf C CXX Fortran) + message("CTEST_FULL_OUTPUT ") set(CMAKE_VERBOSE_MAKEFILE 1) message("ENV_FLAGS = $ENV{FFLAGS}") @@ -9,11 +10,11 @@ message("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}") message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}") set(_SHARED SHARED) -if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(XL|VisualAge)$") +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(XL|VisualAge)$") # We do not implement SHARED Fortran libs on AIX yet! # Workaround: Set LINKER_LANGUAGE to C, which uses 'xlc' and Fortran implicits. set(_SHARED STATIC) -elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") +elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") # g77 2.96 does not support shared libs on Itanium because g2c is not -fPIC execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version OUTPUT_VARIABLE output ERROR_VARIABLE output) @@ -25,10 +26,10 @@ endif() # Pick a module .def file with the properly mangled symbol name. set(world_def "") if(WIN32 AND NOT CYGWIN) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(world_def world_gnu.def) - elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel" OR - "${CMAKE_GENERATOR}" MATCHES "Visual Studio") # Intel plugin + elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR + CMAKE_GENERATOR MATCHES "Visual Studio") # Intel plugin set(world_def world_icl.def) endif() endif() @@ -63,7 +64,7 @@ function(test_fortran_c_interface_module) SYMBOL_NAMESPACE "F_" SYMBOLS ${FORTRAN_FUNCTIONS} ) - include_directories("${testf_BINARY_DIR}") + include_directories("${CMAKE_CURRENT_BINARY_DIR}") # if the name mangling is not found for a F90 compiler # print out some diagnostic stuff for the dashboard @@ -107,7 +108,7 @@ function(test_fortran_c_interface_module) target_link_libraries(maincxx mycxx) # print out some stuff to help debug on machines via cdash - file(READ "${testf_BINARY_DIR}/foo.h" fooh) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/foo.h" fooh) message("foo.h contents:\n${fooh}") endfunction() @@ -115,7 +116,7 @@ endfunction() # call the test_fortran_c_interface_module function if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES "(Intel:MSVC|Absoft:GNU)" - OR ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" )) + OR ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "${CMAKE_C_COMPILER_ID}" )) test_fortran_c_interface_module() else() message("Fortran does not match c compiler") @@ -124,7 +125,7 @@ else() # hack to make g77 work after CL has been enabled # as a languge, cmake needs language specific versions # of these variables.... - if(WIN32 AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(WIN32 AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_CREATE_CONSOLE_EXE ) set(CMAKE_LIBRARY_PATH_FLAG "-L") set(CMAKE_LINK_LIBRARY_FLAG "-l") @@ -133,90 +134,10 @@ else() # gnu and sunpro do not use the same flags here... # however if LDFLAGS is used to set -m64 it causes odd stuf # with the fortran build - if( ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") - AND ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "SunPro")) + if( (CMAKE_C_COMPILER_ID MATCHES "GNU") + AND (CMAKE_Fortran_COMPILER_ID MATCHES "SunPro")) set(CMAKE_EXE_LINKER_FLAGS "") set(CMAKE_Fortran_FLAGS "") endif() endif() - - - - -set(TEST_MODULE_DEPENDS 0) -if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - add_executable(test_module - test_module_main.f90 - test_module_implementation.f90 - test_module_interface.f90) - - add_executable(test_use_in_comment_fixedform - test_use_in_comment_fixedform.f) - set_property(SOURCE test_use_in_comment_fixedform.f PROPERTY Fortran_FORMAT FIXED) - add_executable(test_use_in_comment_freeform - test_use_in_comment_freeform.f90) - set_property(SOURCE test_use_in_comment_freeform.f90 PROPERTY Fortran_FORMAT FREE) - - add_executable(test_in_interface - in_interface/main.f90 - in_interface/module.f90) - - add_definitions(-DFOO -DBAR=1) - include_directories(${testf_SOURCE_DIR}/include) - add_executable(test_preprocess test_preprocess.F90) - - set(TEST_MODULE_DEPENDS 1) -endif() - -if(TEST_MODULE_DEPENDS) - # 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}") - set(External_BUILD_TYPE) - else() - set(External_CONFIG_TYPE) - set(External_BUILD_TYPE -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) - endif() - set(External_SOURCE_DIR "${testf_SOURCE_DIR}/External") - set(External_BINARY_DIR "${testf_BINARY_DIR}/External") - if("${testf_BINARY_DIR}" MATCHES " ") - # Our build tree has a space, so the build tool supports spaces. - # Test using modules from a path with spaces. - set(External_BINARY_DIR "${External_BINARY_DIR} Build") - endif() - add_custom_command( - OUTPUT ${testf_BINARY_DIR}/ExternalProject - COMMAND ${CMAKE_CTEST_COMMAND} - ARGS ${External_CONFIG_TYPE} - --build-and-test - ${External_SOURCE_DIR} - ${External_BINARY_DIR} - --build-noclean - --build-two-config - --build-project ExtFort - --build-generator ${CMAKE_GENERATOR} - --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" - --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} - ${External_BUILD_TYPE} - VERBATIM - ) - add_custom_target(ExternalTarget ALL DEPENDS ${testf_BINARY_DIR}/ExternalProject) - - # Test module output directory if available. - if(CMAKE_Fortran_MODDIR_FLAG) - set(Library_MODDIR "${testf_BINARY_DIR}/Library/modules") - else() - set(Library_MODDIR "${testf_BINARY_DIR}/Library") - endif() - - add_subdirectory(Library) - add_subdirectory(Executable) -endif() diff --git a/Tests/Fortran/Executable/CMakeLists.txt b/Tests/Fortran/Executable/CMakeLists.txt deleted file mode 100644 index 55f21ad46..000000000 --- a/Tests/Fortran/Executable/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -include_directories(${Library_MODDIR}) -include_directories(${External_BINARY_DIR}) -link_directories(${External_BINARY_DIR}) - -add_executable(subdir_exe2 main.f90) -target_link_libraries(subdir_exe2 subdir_mods) -add_dependencies(subdir_exe2 ExternalTarget) -target_link_libraries(subdir_exe2 myext) diff --git a/Tests/Fortran/Executable/main.f90 b/Tests/Fortran/Executable/main.f90 deleted file mode 100644 index f21156cda..000000000 --- a/Tests/Fortran/Executable/main.f90 +++ /dev/null @@ -1,6 +0,0 @@ -PROGRAM MAINF90 - USE libraryModuleA - USE libraryModuleB - USE externalMod - CALL printExtModGreeting -END PROGRAM MAINF90 diff --git a/Tests/Fortran/External/CMakeLists.txt b/Tests/Fortran/External/CMakeLists.txt deleted file mode 100644 index 0eb1cfeed..000000000 --- a/Tests/Fortran/External/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -project(ExtFort Fortran) - -add_library(myext a.f90) - diff --git a/Tests/Fortran/External/a.f90 b/Tests/Fortran/External/a.f90 deleted file mode 100644 index 2be73c53c..000000000 --- a/Tests/Fortran/External/a.f90 +++ /dev/null @@ -1,7 +0,0 @@ -MODULE externalMod -! -CONTAINS - SUBROUTINE printExtModGreeting - WRITE(*,*) "Greetings from Module externalMod" - END SUBROUTINE -END MODULE diff --git a/Tests/Fortran/Library/CMakeLists.txt b/Tests/Fortran/Library/CMakeLists.txt deleted file mode 100644 index 17438cafb..000000000 --- a/Tests/Fortran/Library/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include_directories(${Library_MODDIR}) -add_library(subdir_mods a.f90 b.f90) -add_executable(subdir_exe main.f90) -target_link_libraries(subdir_exe subdir_mods) - -# Test module output directory if available. -if(CMAKE_Fortran_MODDIR_FLAG) - set_target_properties(subdir_mods PROPERTIES - Fortran_MODULE_DIRECTORY modules - ) -endif() diff --git a/Tests/Fortran/Library/a.f90 b/Tests/Fortran/Library/a.f90 deleted file mode 100644 index 3031c0723..000000000 --- a/Tests/Fortran/Library/a.f90 +++ /dev/null @@ -1,3 +0,0 @@ -MODULE libraryModuleA - USE libraryModuleB -END MODULE diff --git a/Tests/Fortran/Library/b.f90 b/Tests/Fortran/Library/b.f90 deleted file mode 100644 index ae1edcb20..000000000 --- a/Tests/Fortran/Library/b.f90 +++ /dev/null @@ -1,2 +0,0 @@ -MODULE libraryModuleB -END MODULE diff --git a/Tests/Fortran/Library/main.f90 b/Tests/Fortran/Library/main.f90 deleted file mode 100644 index 2385408a2..000000000 --- a/Tests/Fortran/Library/main.f90 +++ /dev/null @@ -1,3 +0,0 @@ -PROGRAM MAINF90 - USE libraryModuleA -END PROGRAM MAINF90 diff --git a/Tests/Fortran/in_interface/main.f90 b/Tests/Fortran/in_interface/main.f90 deleted file mode 100644 index 28bcf36d5..000000000 --- a/Tests/Fortran/in_interface/main.f90 +++ /dev/null @@ -1,3 +0,0 @@ -program hello - use test_interface -end program hello diff --git a/Tests/Fortran/in_interface/module.f90 b/Tests/Fortran/in_interface/module.f90 deleted file mode 100644 index 1064d74b0..000000000 --- a/Tests/Fortran/in_interface/module.f90 +++ /dev/null @@ -1,12 +0,0 @@ -module test_interface - - interface dummy - module procedure module_function - end interface - -contains - - subroutine module_function - end subroutine - -end module test_interface
\ No newline at end of file diff --git a/Tests/Fortran/include/test_preprocess.h b/Tests/Fortran/include/test_preprocess.h deleted file mode 100644 index 29ac4b65f..000000000 --- a/Tests/Fortran/include/test_preprocess.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef BAR - PRINT * , 'BAR was defined via ADD_DEFINITIONS' -#else - PRINT *, 'If you can read this something went wrong' -#endif diff --git a/Tests/Fortran/test_module_implementation.f90 b/Tests/Fortran/test_module_implementation.f90 deleted file mode 100644 index de3cb574c..000000000 --- a/Tests/Fortran/test_module_implementation.f90 +++ /dev/null @@ -1,6 +0,0 @@ -FUNCTION TEST_MODULE_FUNCTION(A,B) - REAL :: TEST_MODULE_FUNCTION - REAL, INTENT(IN) :: A - REAL, INTENT(IN) :: B - TEST_MODULE_FUNCTION = A + B -END FUNCTION TEST_MODULE_FUNCTION diff --git a/Tests/Fortran/test_module_interface.f90 b/Tests/Fortran/test_module_interface.f90 deleted file mode 100644 index dd0f35c56..000000000 --- a/Tests/Fortran/test_module_interface.f90 +++ /dev/null @@ -1,9 +0,0 @@ -MODULE TEST_MODULE - INTERFACE - FUNCTION TEST_MODULE_FUNCTION(A,B) - REAL :: TEST_MODULE_FUNCTION - REAL, INTENT(IN) :: A - REAL, INTENT(IN) :: B - END FUNCTION TEST_MODULE_FUNCTION - END INTERFACE -END MODULE TEST_MODULE diff --git a/Tests/Fortran/test_module_main.f90 b/Tests/Fortran/test_module_main.f90 deleted file mode 100644 index 6ac97fa91..000000000 --- a/Tests/Fortran/test_module_main.f90 +++ /dev/null @@ -1,4 +0,0 @@ -PROGRAM MAINF90 - USE TEST_MODULE - PRINT *,'Sum is',TEST_MODULE_FUNCTION(1., 2.) -END PROGRAM MAINF90 diff --git a/Tests/Fortran/test_preprocess.F90 b/Tests/Fortran/test_preprocess.F90 deleted file mode 100644 index e4f1fbe76..000000000 --- a/Tests/Fortran/test_preprocess.F90 +++ /dev/null @@ -1,51 +0,0 @@ -MODULE Available -! no conent -END MODULE - -PROGRAM PPTEST -! value of InPPFalseBranch ; values of SkipToEnd -! 0 <empty> -#ifndef FOO - ! 1 ; <0> - USE NotAvailable -# ifndef FOO - ! 2 ; <0,0> - USE NotAvailable -# else - ! 2 ; <0,0> - USE NotAvailable -# endif - ! 1 ; <0> -# ifdef FOO - ! 2 ; <0,1> - USE NotAvailable -# else - ! 2 ; <0,1> - USE NotAvailable -# endif - ! 1 ; <0> -#else - ! 0 ; <0> - USE Available -# ifndef FOO - ! 1 ; <0,0> - USE NotAvailable -# else - ! 0 ; <0,0> - USE Available -# endif - ! 0 ; <0> -# ifdef FOO - ! 0 ; <0,1> - USE Available -# else - ! 1 ; <0,1> - USE NotAvailable -# endif - ! 0 ; <0> -#endif -! 0 ; <empty> - -#include "test_preprocess.h" - -END PROGRAM diff --git a/Tests/Fortran/test_use_in_comment_fixedform.f b/Tests/Fortran/test_use_in_comment_fixedform.f deleted file mode 100644 index 39f486bf9..000000000 --- a/Tests/Fortran/test_use_in_comment_fixedform.f +++ /dev/null @@ -1,7 +0,0 @@ - PROGRAM foo -! USE bar -! use bar -! Use bar - - WRITE(*,*) 'Hello, Fortran world.' - END PROGRAM diff --git a/Tests/Fortran/test_use_in_comment_freeform.f90 b/Tests/Fortran/test_use_in_comment_freeform.f90 deleted file mode 100644 index 48bcd5a21..000000000 --- a/Tests/Fortran/test_use_in_comment_freeform.f90 +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM foo -! USE bar -! use bar -! Use bar - - WRITE(*,*) 'Hello, Fortran world.' -END PROGRAM |