File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9898 vcpkg : true
9999 ccache : true
100100 clangtidy : true
101+ make : true
101102
102103 cppcheck : true
103104
@@ -132,6 +133,9 @@ jobs:
132133
133134 gcovr -j ${{env.nproc}} --delete --root ./ --print-summary --xml-pretty --xml coverage.xml ./build --gcov-executable '${{ matrix.gcov_executable }}'
134135
136+ # test installation
137+ make test_install
138+
135139 - name : Windows - Test and coverage
136140 if : runner.os == 'Windows'
137141 run : |
@@ -140,6 +144,8 @@ jobs:
140144 cd ./build/my_header_lib/test; ctest -C ${{matrix.build_type}} --output-on-failure; cd ../../../
141145 cd ./build/my_lib/test; ctest -C ${{matrix.build_type}} --output-on-failure; cd ../../../
142146 '
147+ # test installation
148+ make test_install
143149
144150 - name : Perform CodeQL Analysis
145151 if : ${{ contains(matrix.os, 'ubuntu') && contains(matrix.compiler, 'llvm') }}
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ add_subdirectory(./my_exe)
8181add_subdirectory (./my_lib )
8282add_subdirectory (./my_header_lib )
8383
84+ # the variables set using CACHE STRING "" are passed to package_project
85+
8486# Package the project
8587package_project (
8688 TARGETS
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ test_release:
2424 (cd build/my_header_lib/test && ctest -C RelWithDebInfo --output-on-failure)
2525 (cd build/my_lib/test && ctest -C RelWithDebInfo --output-on-failure)
2626
27+ test_install :
28+ cmake --install ./build --prefix ./install
29+
2730docs :
2831 cmake ./ -B ./build -G " Ninja Multi-Config" -DCMAKE_BUILD_TYPE:STRING=Debug -DFEATURE_DOCS:BOOL=ON -DFEATURE_TESTS:BOOL=OFF
2932 cmake --build ./build --target doxygen-docs --config Debug
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ target_link_libraries(my_exe PRIVATE project_options project_warnings) # link pr
33
44# Includes
55# because my_exe includes are private, it uses absolute paths.
6- set (my_exe_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /include" )
6+ set (my_exe_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /include" CACHE STRING "" )
77target_include_directories (my_exe PRIVATE "${my_exe_INCLUDE_DIR} " )
88
99# Find dependencies:
10- set (my_exe_DEPENDENCIES_CONFIGURED fmt)
10+ set (my_exe_DEPENDENCIES_CONFIGURED fmt CACHE STRING "" )
1111
1212foreach (DEPENDENCY ${my_exe_DEPENDENCIES_CONFIGURED} )
1313 find_package (${DEPENDENCY} CONFIG REQUIRED )
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ add_library(my_header_lib INTERFACE)
22target_link_libraries (my_header_lib INTERFACE project_options project_warnings ) # link project_options/warnings
33
44# Includes
5- set (my_header_lib_INCLUDE_DIR ". /include" ) # must be relative paths
5+ set (my_header_lib_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /include" CACHE STRING " " ) # must be relative paths
66target_include_directories (
7- my_header_lib INTERFACE "$<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR} / ${ my_header_lib_INCLUDE_DIR} >"
7+ my_header_lib INTERFACE "$<BUILD_INTERFACE :${my_header_lib_INCLUDE_DIR} >"
88 "$<INSTALL_INTERFACE :${CMAKE_INSTALL_INCLUDEDIR} >" )
99
1010# Find dependencies:
11- set (my_header_lib_DEPENDENCIES_CONFIGURED fmt)
11+ set (my_header_lib_DEPENDENCIES_CONFIGURED fmt CACHE STRING "" )
1212
1313foreach (DEPENDENCY ${my_header_lib_DEPENDENCIES_CONFIGURED} )
1414 find_package (${DEPENDENCY} CONFIG REQUIRED )
Original file line number Diff line number Diff line change @@ -2,12 +2,16 @@ add_library(my_lib "./src/my_lib/lib.cpp")
22target_link_libraries (my_lib PRIVATE project_options project_warnings ) # link project_options/warnings
33
44# Includes
5- set (my_lib_INCLUDE_DIR "include" ) # must be relative paths
6- target_include_directories (my_lib PUBLIC "$<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR} /${my_lib_INCLUDE_DIR} >"
5+ set (my_lib_INCLUDE_DIR
6+ "${CMAKE_CURRENT_SOURCE_DIR} /include"
7+ CACHE STRING "" )
8+ target_include_directories (my_lib PUBLIC "$<BUILD_INTERFACE :${my_lib_INCLUDE_DIR} >"
79 "$<INSTALL_INTERFACE :./${CMAKE_INSTALL_INCLUDEDIR} >" )
810
911# Find dependencies:
10- set (my_lib_DEPENDENCIES_CONFIGURED fmt)
12+ set (my_lib_DEPENDENCIES_CONFIGURED
13+ fmt
14+ CACHE STRING "" )
1115
1216foreach (DEPENDENCY ${my_lib_DEPENDENCIES_CONFIGURED} )
1317 find_package (${DEPENDENCY} CONFIG REQUIRED )
You can’t perform that action at this time.
0 commit comments