Skip to content

Commit

Permalink
Moved headertest generation to a new MCRL2_ENABLE_HEADER_TESTS cmake …
Browse files Browse the repository at this point in the history
…option.
  • Loading branch information
mlaveaux committed Jan 11, 2019
1 parent d777e33 commit 77dadb1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ option(MCRL2_ENABLE_GUI_TOOLS "Enable compilation of tools with a graphica
option(MCRL2_ENABLE_EXPERIMENTAL "Enable compilation of experimental tools." OFF)
option(MCRL2_ENABLE_DEPRECATED "Enable compilation of deprecated tools." OFF)
option(MCRL2_ENABLE_DEVELOPER "Enable compilation of developer tools." OFF)
option(MCRL2_ENABLE_TESTS "Enable generation of test targets." OFF)
option(MCRL2_ENABLE_HEADER_TESTS "Enable generation of headertest targets." OFF)
option(MCRL2_ENABLE_TESTS "Enable generation of library, tool and random test targets." OFF)
option(MCRL2_ENABLE_BENCHMARKS "Enable generation of benchmark targets." OFF)
option(MCRL2_ENABLE_CODE_COVERAGE "Enable generation of code coverage statistics." OFF)
option(MCRL2_EXTRA_TOOL_TESTS "Enable testing of tools on more mCRL2 specifications." OFF)
Expand Down
6 changes: 4 additions & 2 deletions build/cmake/AddMCRL2Binary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ function(_add_mcrl2_binary TARGET_NAME TARGET_TYPE)
LIBRARY DESTINATION ${MCRL2_LIBRARY_PATH}
ARCHIVE DESTINATION ${MCRL2_ARCHIVE_PATH}
FRAMEWORK DESTINATION ${MCRL2_LIBRARY_PATH})
_install_header_files(${TARGET_INCLUDE_FILES})
_install_header_files(${TARGET_INCLUDE_FILES})
if (NOT ${ARG_NOTEST} AND ${MCRL2_ENABLE_HEADER_TESTS})
_add_header_tests(${TARGET_NAME} "${ARG_NOHEADERTEST}")
endif()
if (NOT ${ARG_NOTEST} AND ${MCRL2_ENABLE_TESTS})
_add_header_tests(${TARGET_NAME} "${ARG_NOHEADERTEST}")
_add_library_tests(${TARGET_NAME})
endif()
elseif(${TARGET_TYPE} STREQUAL "EXECUTABLE")
Expand Down
21 changes: 12 additions & 9 deletions libraries/pbes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ if(${MCRL2_ENABLE_TESTS})
get_filename_component(base ${test} NAME_WE)
target_link_libraries(librarytest_mcrl2_pbes_${base} mcrl2_pbes mcrl2_bes)
endforeach()
file(GLOB_RECURSE headers "include/*.h")
foreach(header ${headers})
file(RELATIVE_PATH cppname ${CMAKE_CURRENT_SOURCE_DIR}/include ${header})
file(TO_CMAKE_PATH ${cppname} cppname)
string(REGEX REPLACE "\\.|/" "_" testname "${cppname}")
set(testname headertest_${testname})
if(NOT TARGET ${testname})

if(${MCRL2_ENABLE_HEADER_TESTS})
file(GLOB_RECURSE headers "include/*.h")
foreach(header ${headers})
file(RELATIVE_PATH cppname ${CMAKE_CURRENT_SOURCE_DIR}/include ${header})
file(TO_CMAKE_PATH ${cppname} cppname)
string(REGEX REPLACE "\\.|/" "_" testname "${cppname}")
set(testname headertest_${testname})
if(NOT TARGET ${testname})
target_link_libraries(${testname} mcrl2_pbes mcrl2_bes)
endif()
endforeach()
endif()
endforeach()
endif()
endif()

0 comments on commit 77dadb1

Please sign in to comment.