Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise CTest configuration #4490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Modelica/Resources/BuildProjects/CMake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ option(

# Option whether to install ModelicaExternalC
option(MODELICA_INSTALL_EXTC "Install ModelicaExternalC library" OFF)

# Option to enable testsuite
option(MODELICA_BUILD_TESTING "Build testing" ON)

set(BUILD_TESTING OFF)
if(MODELICA_BUILD_TESTING)
set(BUILD_TESTING ON)
endif()
25 changes: 13 additions & 12 deletions Modelica/Resources/BuildProjects/CMake/test.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
include(CTest)

if(BUILD_TESTING)
if(MODELICA_BUILD_TESTING)
set(MODELICA_TEST_DIR_AUX "${MODELICA_RESOURCES_DIR}/../../.CI/Test")
get_filename_component(MODELICA_TEST_DIR "${MODELICA_TEST_DIR_AUX}" ABSOLUTE)
if(EXISTS "${MODELICA_TEST_DIR}")
enable_testing()
set(MODELICA_TESTS
FileSystem
ModelicaStrings
Expand All @@ -14,32 +13,34 @@ if(BUILD_TESTING)
TablesFromTxtFile
TablesNoUsertab
)
foreach(TEST ${MODELICA_TESTS})
add_executable(Test${TEST} "${MODELICA_TEST_DIR}/${TEST}.c")
target_link_libraries(Test${TEST}
foreach(test_file ${MODELICA_TESTS})
set(TEST_EXECUTABLE Test${test_file})
add_executable(${TEST_EXECUTABLE} "${MODELICA_TEST_DIR}/${test_file}.c")
target_link_libraries(${TEST_EXECUTABLE}
ModelicaExternalC
ModelicaStandardTables
ModelicaIO
ModelicaMatIO
)
if(MODELICA_BUILD_ZLIB)
target_link_libraries(Test${TEST} zlib)
target_link_libraries(${TEST_EXECUTABLE} zlib)
else()
target_link_libraries(Test${TEST} z)
target_link_libraries(${TEST_EXECUTABLE} z)
endif()
if(UNIX)
target_link_libraries(Test${TEST} m)
target_link_libraries(${TEST_EXECUTABLE} m)
endif()
set_target_properties(${TEST_EXECUTABLE} PROPERTIES FOLDER "Test")
add_test(
NAME Test${TEST}
COMMAND Test${TEST}
NAME ${TEST_EXECUTABLE}
COMMAND ${TEST_EXECUTABLE}
WORKING_DIRECTORY "${MODELICA_TEST_DIR}"
)
endforeach()
else()
message(WARNING
" Testsuite not found in \"${MODELICA_TEST_DIR}\"."
" Set BUILD_TESTING to OFF to silence this warning."
" Set MODELICA_BUILD_TESTING to OFF to silence this warning."
)
endif()
endif()
2 changes: 2 additions & 0 deletions Modelica/Resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ endif()

project(Modelica_Standard_Library_Tables C)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(BuildProjects/CMake/Modelica_platform.cmake)
include(BuildProjects/CMake/Modelica_utilities.cmake)

Expand Down
Loading