1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 21:51:12 +02:00
ModernCppStarter/standalone/CMakeLists.txt
ClausKlein a3bc933175 Modernize cmake project files
Fix install target

Update cmake-format config file

Format all cmake files.

Update CPM.cmake version.

Use FILE_SET HEADER to verify and install the header files.

Prevent build problems caused by CPM_USE_LOCAL_PACKAGES

Prevent problems with doctest if local found
2025-03-06 07:00:40 +01:00

33 lines
766 B
CMake

cmake_minimum_required(VERSION 3.24...3.31)
project(GreeterStandalone LANGUAGES CXX)
# --- Import tools ----
include(../cmake/tools.cmake)
# ---- Dependencies ----
include(../cmake/CPM.cmake)
CPMAddPackage(
GITHUB_REPOSITORY jarro2783/cxxopts
VERSION 3.2.1
OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES"
)
CPMAddPackage(
NAME Greeter
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..
FORCE ON
)
# ---- Create standalone executable ----
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
add_executable(${PROJECT_NAME} ${sources})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 OUTPUT_NAME "Greeter")
target_link_libraries(${PROJECT_NAME} Greeter::Greeter cxxopts)