use namespaced target (#67)
* use namespaced target * update .cmake-format for PackageProject.cmake 1.4
This commit is contained in:
parent
eadea97fe4
commit
8dc50e5294
4 changed files with 5 additions and 3 deletions
|
@ -48,6 +48,7 @@ parse:
|
||||||
kwargs:
|
kwargs:
|
||||||
NAME: 1
|
NAME: 1
|
||||||
VERSION: 1
|
VERSION: 1
|
||||||
|
NAMESPACE: 1
|
||||||
INCLUDE_DIR: 1
|
INCLUDE_DIR: 1
|
||||||
INCLUDE_DESTINATION: 1
|
INCLUDE_DESTINATION: 1
|
||||||
BINARY_DIR: 1
|
BINARY_DIR: 1
|
||||||
|
|
|
@ -27,7 +27,7 @@ include(cmake/CPM.cmake)
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
NAME PackageProject.cmake
|
NAME PackageProject.cmake
|
||||||
GITHUB_REPOSITORY TheLartians/PackageProject.cmake
|
GITHUB_REPOSITORY TheLartians/PackageProject.cmake
|
||||||
VERSION 1.3
|
VERSION 1.4
|
||||||
)
|
)
|
||||||
|
|
||||||
# ---- Add source files ----
|
# ---- Add source files ----
|
||||||
|
@ -67,6 +67,7 @@ string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION)
|
||||||
packageProject(
|
packageProject(
|
||||||
NAME ${PROJECT_NAME}
|
NAME ${PROJECT_NAME}
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
|
NAMESPACE ${PROJECT_NAME}
|
||||||
BINARY_DIR ${PROJECT_BINARY_DIR}
|
BINARY_DIR ${PROJECT_BINARY_DIR}
|
||||||
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
|
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
|
||||||
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
|
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
|
||||||
|
|
|
@ -27,4 +27,4 @@ add_executable(GreeterStandalone ${sources})
|
||||||
|
|
||||||
set_target_properties(GreeterStandalone PROPERTIES CXX_STANDARD 17 OUTPUT_NAME "Greeter")
|
set_target_properties(GreeterStandalone PROPERTIES CXX_STANDARD 17 OUTPUT_NAME "Greeter")
|
||||||
|
|
||||||
target_link_libraries(GreeterStandalone Greeter cxxopts)
|
target_link_libraries(GreeterStandalone Greeter::Greeter cxxopts)
|
||||||
|
|
|
@ -39,7 +39,7 @@ CPMAddPackage(
|
||||||
|
|
||||||
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
|
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
|
||||||
add_executable(GreeterTests ${sources})
|
add_executable(GreeterTests ${sources})
|
||||||
target_link_libraries(GreeterTests doctest Greeter)
|
target_link_libraries(GreeterTests doctest Greeter::Greeter)
|
||||||
|
|
||||||
set_target_properties(GreeterTests PROPERTIES CXX_STANDARD 17)
|
set_target_properties(GreeterTests PROPERTIES CXX_STANDARD 17)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue