diff options
Diffstat (limited to 'Tests/CompileOptions')
-rw-r--r-- | Tests/CompileOptions/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/CompileOptions/main.cpp | 15 |
2 files changed, 28 insertions, 4 deletions
diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index c9f1710..15a993c 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -4,6 +4,10 @@ project(CompileOptions) add_library(testlib other.cpp) +if(TEST_FORTRAN) + enable_language(Fortran) +endif() + add_executable(CompileOptions main.cpp) macro(get_compiler_test_genex lst lang) @@ -13,6 +17,9 @@ endmacro() get_compiler_test_genex(c_tests C) get_compiler_test_genex(cxx_tests CXX) +if(TEST_FORTRAN) + get_compiler_test_genex(fortran_tests Fortran) +endif() set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "-DTEST_DEFINE" @@ -21,6 +28,7 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "SHELL:" # produces no options ${c_tests} ${cxx_tests} + ${fortran_tests} ) if(BORLAND OR WATCOM) # these compilers do not support separate -D flags @@ -54,3 +62,12 @@ target_compile_definitions(CompileOptions "EXPECTED_C_COMPILER_VERSION=\"${CMAKE_C_COMPILER_VERSION}\"" "EXPECTED_CXX_COMPILER_VERSION=\"${CMAKE_CXX_COMPILER_VERSION}\"" ) + +if(TEST_FORTRAN) + # Definitions for the C++ code to test the values + target_compile_definitions(CompileOptions + PRIVATE + "TEST_FORTRAN" + "EXPECTED_Fortran_COMPILER_VERSION=\"${CMAKE_Fortran_COMPILER_VERSION}\"" + ) +endif() diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 1379940..d94a169 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -47,10 +47,17 @@ int main() #endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && - strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == - 0 && - TEST_C_COMPILER_VERSION_EQUALITY == 1 && - TEST_CXX_COMPILER_VERSION_EQUALITY == 1) + strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0 +#ifdef TEST_FORTRAN + && strcmp(EXPECTED_Fortran_COMPILER_VERSION, + TEST_Fortran_COMPILER_VERSION) == 0 +#endif + && TEST_C_COMPILER_VERSION_EQUALITY == 1 && + TEST_CXX_COMPILER_VERSION_EQUALITY == 1 +#ifdef TEST_FORTRAN + && TEST_Fortran_COMPILER_VERSION_EQUALITY == 1 +#endif + ) ? 0 : 1; } |