generated from TheLartians/ModernCppStarter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yangli
committed
Sep 16, 2022
1 parent
3d088cc
commit 1f7119f
Showing
5 changed files
with
116 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,19 @@ cmake_minimum_required(VERSION 3.14...3.22) | |
|
||
# Note: update this to your new project's name and version | ||
project( | ||
boss | ||
VERSION 1.0.0 | ||
LANGUAGES CXX | ||
boss | ||
VERSION 1.0.0 | ||
LANGUAGES CXX | ||
) | ||
|
||
# ---- Include guards ---- | ||
|
||
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) | ||
message( | ||
FATAL_ERROR | ||
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there." | ||
) | ||
endif () | ||
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) | ||
message( | ||
FATAL_ERROR | ||
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there." | ||
) | ||
endif() | ||
|
||
option(BOSS_HAS_BOOST "Do not download Boost" OFF) | ||
|
||
|
@@ -34,12 +34,11 @@ include(../cmake/CPM.cmake) | |
CPMAddPackage("gh:TheLartians/[email protected]") | ||
|
||
CPMAddPackage( | ||
GITHUB_REPOSITORY ylab-hi/BINARY | ||
VERSION 1.1.0 | ||
OPTIONS "BINARY_BUILD_STANDALONE NO" "BINARY_BUILD_TESTS NO" | ||
GITHUB_REPOSITORY ylab-hi/BINARY | ||
VERSION 1.1.0 | ||
OPTIONS "BINARY_BUILD_STANDALONE NO" "BINARY_BUILD_TESTS NO" | ||
) | ||
|
||
|
||
find_package(Boost REQUIRED COMPONENTS system iostreams) | ||
|
||
# ---- Add source files ---- | ||
|
@@ -61,11 +60,13 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20) | |
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->") | ||
|
||
# Link dependencies | ||
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog Boost::boost Boost::iostreams binary::binary) | ||
target_link_libraries( | ||
${PROJECT_NAME} PUBLIC spdlog::spdlog Boost::boost Boost::iostreams binary::binary | ||
) | ||
|
||
target_include_directories( | ||
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/../include> | ||
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}> | ||
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/../include> | ||
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}> | ||
) | ||
|
||
# ---- Create an installable target ---- | ||
|
@@ -76,13 +77,13 @@ target_include_directories( | |
string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION) | ||
|
||
packageProject( | ||
NAME ${PROJECT_NAME} | ||
VERSION ${PROJECT_VERSION} | ||
NAMESPACE ${PROJECT_NAME} | ||
BINARY_DIR ${PROJECT_BINARY_DIR} | ||
INCLUDE_DIR . | ||
INCLUDE_DESTINATION ../include/${PROJECT_NAME}-${PROJECT_VERSION} | ||
VERSION_HEADER "${VERSION_HEADER_LOCATION}" | ||
COMPATIBILITY SameMajorVersion | ||
DEPENDENCIES "spdlog 1.10.0" | ||
NAME ${PROJECT_NAME} | ||
VERSION ${PROJECT_VERSION} | ||
NAMESPACE ${PROJECT_NAME} | ||
BINARY_DIR ${PROJECT_BINARY_DIR} | ||
INCLUDE_DIR . | ||
INCLUDE_DESTINATION ../include/${PROJECT_NAME}-${PROJECT_VERSION} | ||
VERSION_HEADER "${VERSION_HEADER_LOCATION}" | ||
COMPATIBILITY SameMajorVersion | ||
DEPENDENCIES "spdlog 1.10.0" | ||
) |
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
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