Skip to content

Commit

Permalink
Fix catch installation issue (microsoft#540)
Browse files Browse the repository at this point in the history
Catch was being installed to the root of the cmake project. This
violated the source code tree itself and would not work at all if GSL
was being consumed with add_subdirectory.

CMake will now install catch to the build tree under /dependencies.
  • Loading branch information
tiagomacarios authored and Neil MacIntosh committed Aug 17, 2017
1 parent 2b8d204 commit 25f913e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CMakeFiles
build
include/catch
tests/CMakeFiles
tests/Debug
*.opensdf
Expand Down
7 changes: 6 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(GSLTests CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

list(APPEND CATCH_CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}"
"-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external"
"-DNO_SELFTEST=true"
)

Expand Down Expand Up @@ -48,6 +48,11 @@ target_compile_options(gsl_tests_config INTERFACE
>
)

# for tests to find the catch header
target_include_directories(gsl_tests_config INTERFACE
${CMAKE_BINARY_DIR}/external/include
)

# set definitions for tests
target_compile_definitions(gsl_tests_config INTERFACE
GSL_THROW_ON_CONTRACT_VIOLATION
Expand Down

0 comments on commit 25f913e

Please sign in to comment.