-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from robertmrk/feature/cmake-cleanup
Define CMake/CTest tests
- Loading branch information
Showing
3 changed files
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
# The unit test executable. | ||
add_executable(json_unit | ||
set(JSON_UNITTEST_TARGET_NAME "json_unit") | ||
add_executable(${JSON_UNITTEST_TARGET_NAME} | ||
"src/catch.hpp" | ||
"src/unit.cpp" | ||
) | ||
|
||
set_target_properties(json_unit PROPERTIES | ||
set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES | ||
CXX_STANDARD 11 | ||
CXX_STANDARD_REQUIRED ON | ||
COMPILE_DEFINITIONS "$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>" | ||
COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>" | ||
) | ||
|
||
# Install the test binary. | ||
install(TARGETS json_unit RUNTIME DESTINATION test/bin) | ||
target_include_directories(${JSON_UNITTEST_TARGET_NAME} PRIVATE "src") | ||
target_link_libraries(${JSON_UNITTEST_TARGET_NAME} ${JSON_TARGET_NAME}) | ||
|
||
# Copy the test data to the install tree. | ||
install(DIRECTORY data/ DESTINATION test/data) | ||
|
||
target_include_directories(json_unit PRIVATE "src") | ||
target_link_libraries(json_unit ${JSON_TARGET_NAME}) | ||
add_test(NAME "${JSON_UNITTEST_TARGET_NAME}_default" | ||
COMMAND ${JSON_UNITTEST_TARGET_NAME} | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
) | ||
add_test(NAME "${JSON_UNITTEST_TARGET_NAME}_all" | ||
COMMAND ${JSON_UNITTEST_TARGET_NAME} "*" | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
) |