mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-08-30 21:51:12 +02:00
Added ${CMAKE_PROJECT_NAME}
This commit is contained in:
parent
2528ba4123
commit
004f33fde1
3 changed files with 9 additions and 9 deletions
|
@ -7,12 +7,12 @@ project(GreeterDocs)
|
|||
include(../cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage("gh:mosra/m.css#42d4a9a48f31f5df6e246c948403b54b50574a2a")
|
||||
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
CPMAddPackage(NAME ${CMAKE_PROJECT_NAME} SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
|
||||
# ---- Doxygen variables ----
|
||||
|
||||
# set Doxyfile variables
|
||||
set(DOXYGEN_PROJECT_NAME Greeter)
|
||||
set(DOXYGEN_PROJECT_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(DOXYGEN_PROJECT_VERSION ${Greeter_VERSION})
|
||||
set(DOXYGEN_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
|
||||
|
|
|
@ -16,7 +16,7 @@ CPMAddPackage(
|
|||
OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES"
|
||||
)
|
||||
|
||||
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
CPMAddPackage(NAME ${CMAKE_PROJECT_NAME} SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
|
||||
# ---- Create standalone executable ----
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ CPMAddPackage("gh:onqtam/doctest#2.4.5")
|
|||
CPMAddPackage("gh:TheLartians/Format.cmake@1.7.0")
|
||||
|
||||
if(TEST_INSTALLED_VERSION)
|
||||
find_package(Greeter REQUIRED)
|
||||
find_package(${CMAKE_PROJECT_NAME} REQUIRED)
|
||||
else()
|
||||
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
CPMAddPackage(NAME ${CMAKE_PROJECT_NAME} SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
endif()
|
||||
|
||||
# ---- Create binary ----
|
||||
|
@ -34,9 +34,9 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
|
|||
# enable compiler warnings
|
||||
if(NOT TEST_INSTALLED_VERSION)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
target_compile_options(Greeter PUBLIC -Wall -Wpedantic -Wextra -Werror)
|
||||
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC -Wall -Wpedantic -Wextra -Werror)
|
||||
elseif(MSVC)
|
||||
target_compile_options(Greeter PUBLIC /W4 /WX)
|
||||
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC /W4 /WX)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -54,6 +54,6 @@ doctest_discover_tests(${PROJECT_NAME})
|
|||
# ---- code coverage ----
|
||||
|
||||
if(ENABLE_TEST_COVERAGE)
|
||||
target_compile_options(Greeter PUBLIC -O0 -g -fprofile-arcs -ftest-coverage)
|
||||
target_link_options(Greeter PUBLIC -fprofile-arcs -ftest-coverage)
|
||||
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC -O0 -g -fprofile-arcs -ftest-coverage)
|
||||
target_link_options(${CMAKE_PROJECT_NAME} PUBLIC -fprofile-arcs -ftest-coverage)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue