Skip to content

Commit

Permalink
build: replace target_include_directories with target_sources
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal committed Dec 16, 2023
1 parent 0917daf commit 66e2690
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ cpmgetpackage(argparse)
cpmgetpackage(CheckWarning.cmake)

add_library(my_fibonacci src/sequence.cpp)
target_include_directories(my_fibonacci PUBLIC include)

target_sources(
my_fibonacci PUBLIC FILE_SET HEADERS
BASE_DIRS include
FILES include/my_fibonacci/sequence.hpp
)

set_property(TARGET my_fibonacci PROPERTY CXX_STANDARD 11)
if(BUILD_TESTING)
target_check_warning(my_fibonacci)
Expand All @@ -49,8 +55,13 @@ if(BUILD_TESTING)
get_target_property(my_fibonacci_SOURCES my_fibonacci SOURCES)
add_executable(my_fibonacci_test test/sequence_test.cpp ${my_fibonacci_SOURCES})

get_target_property(my_fibonacci_INCLUDES my_fibonacci INCLUDE_DIRECTORIES)
target_include_directories(my_fibonacci_test PRIVATE ${my_fibonacci_INCLUDES})
get_target_property(my_fibonacci_HEADER_DIRS my_fibonacci HEADER_DIRS)
get_target_property(my_fibonacci_HEADER_SET my_fibonacci HEADER_SET)
target_sources(
my_fibonacci_test PUBLIC FILE_SET HEADERS
BASE_DIRS ${my_fibonacci_HEADER_DIRS}
FILES ${my_fibonacci_HEADER_SET}
)

target_link_libraries(my_fibonacci_test PRIVATE Catch2::Catch2WithMain)

Expand Down

0 comments on commit 66e2690

Please sign in to comment.