From fa4ac78f4a56bd717811b4f6a88ed9526544bf79 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 12 Mar 2025 16:28:52 -0400 Subject: [PATCH] Tests/FortranModules: Simplify check for submodules support --- Tests/CMakeLists.txt | 4 +++- Tests/FortranModules/CMakeLists.txt | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c6ea77d67b..b03c827736 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3260,6 +3260,9 @@ if(BUILD_TESTING) # FIXME(lfortran): The compiler fails on the test's modules. AND NOT CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran" ) + if(DEFINED CMake_TEST_Fortran_SUBMODULES) + list(PREPEND CMake_TEST_FortranModules_BUILD_OPTIONS -DCMake_TEST_Fortran_SUBMODULES:BOOL=${CMake_TEST_Fortran_SUBMODULES}) + endif() add_test(FortranModules ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/FortranModules" @@ -3268,7 +3271,6 @@ if(BUILD_TESTING) --build-project FortranModules --build-options -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} - -DCMake_TEST_Fortran_SUBMODULES:BOOL=${CMake_TEST_Fortran_SUBMODULES} ${CMake_TEST_FortranModules_BUILD_OPTIONS} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranModules") diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index 555c994c6f..e424230137 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -10,9 +10,7 @@ if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "V set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() -if("x${CMake_TEST_Fortran_SUBMODULES}" STREQUAL "x" - AND NOT CMAKE_VERSION VERSION_LESS 3.6.20160923 # for CheckFortranSourceCompiles SRC_EXT - ) +if(NOT DEFINED CMake_TEST_Fortran_SUBMODULES) include(CheckFortranSourceCompiles) CHECK_Fortran_SOURCE_COMPILES([[ module parent