-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- setting compiler flags via interface library. There are flags for the library and the tests - showing which version of external lib (catch2) is being fetched
- Loading branch information
Showing
6 changed files
with
13 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_library(options_compile_flags INTERFACE) | ||
target_compile_options(options_compile_flags INTERFACE -Wall -Wextra -Wpedantic) | ||
|
||
add_library(options_tests_compile_flags INTERFACE) | ||
target_compile_options(options_tests_compile_flags INTERFACE -Wall -Wextra -Wpedantic) |
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,2 +1,2 @@ | ||
add_executable(example example.cpp) | ||
target_link_libraries(example PRIVATE options) | ||
target_link_libraries(example PRIVATE options options_compile_flags) |
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,2 +1,3 @@ | ||
add_library(options STATIC Converters.cpp Option.cpp Options.cpp) | ||
target_include_directories(options PUBLIC ..) | ||
target_link_libraries(options PRIVATE options_compile_flags) |
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,16 +1,17 @@ | ||
include(FetchContent) | ||
|
||
set(CATCH2_GIT_TAG v3.5.2) | ||
FetchContent_Declare( | ||
Catch2 | ||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git | ||
GIT_TAG v3.5.2 | ||
GIT_TAG ${CATCH2_GIT_TAG} | ||
GIT_SHALLOW TRUE) | ||
|
||
message(STATUS "Making Catch2 available...") | ||
message(STATUS "Making Catch2 ${CATCH2_GIT_TAG} available...") | ||
FetchContent_MakeAvailable(Catch2) | ||
message(STATUS "Catch2 ready") | ||
|
||
enable_testing() | ||
|
||
add_executable(${PROJECT_NAME}_tests Option_Test.cpp Options_Test.cpp) | ||
target_link_libraries(${PROJECT_NAME}_tests PRIVATE options Catch2WithMain) | ||
target_link_libraries(${PROJECT_NAME}_tests PRIVATE options options_tests_compile_flags Catch2WithMain) |