Skip to content

Commit

Permalink
Some minor cmake changes to better support subproject usage
Browse files Browse the repository at this point in the history
Co-authored-by: Bret Brown <[email protected]>
  • Loading branch information
2 people authored and eliaskosunen committed May 15, 2024
1 parent 8bb1ca0 commit 15c3547
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (SCN_IS_TOP_PROJECT AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(cmake/util.cmake)
include(cmake/options.cmake)
Expand Down
8 changes: 4 additions & 4 deletions tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,21 @@ add_custom_target(scn_stdin_test_prepare ALL
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_LIST_DIR}/stdin_test_runner.py"
"${CMAKE_CURRENT_LIST_DIR}/stdin_test_input.txt"
"${CMAKE_BINARY_DIR}/tests/unittests"
"${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Copying stdin test runner"
)
add_custom_target(scn_examples_test_prepare ALL
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_LIST_DIR}/examples_test_runner.py"
"${CMAKE_BINARY_DIR}"
"${PROJECT_BINARY_DIR}"
COMMENT "Copying examples test runner"
)

find_package(Python3 COMPONENTS Interpreter)
if (Python3_FOUND)
add_test(NAME scn_stdin_test COMMAND ${Python3_EXECUTABLE} "${CMAKE_BINARY_DIR}/tests/unittests/stdin_test_runner.py")
add_test(NAME scn_stdin_test COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/stdin_test_runner.py")
if (SCN_EXAMPLES)
add_test(NAME scn_examples_test COMMAND ${Python3_EXECUTABLE} "${CMAKE_BINARY_DIR}/examples_test_runner.py")
add_test(NAME scn_examples_test COMMAND ${Python3_EXECUTABLE} "${PROJECT_BINARY_DIR}/examples_test_runner.py")
else()
message(STATUS "scn_examples_test disabled, because SCN_EXAMPLES is OFF")
endif()
Expand Down

0 comments on commit 15c3547

Please sign in to comment.