1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-31 22:21:13 +02:00
ModernCppStarter/standalone/CMakeLists.txt
ClausKlein 79060d4af6 do it my way, modernize cmake
build dynamic lib
use makefile wrapper to test all use cases
include clang-tidy config file
prevent clang-tidy warnings
2021-02-12 18:52:34 +01:00

34 lines
889 B
CMake

cmake_minimum_required(VERSION 3.14...3.19)
project(GreeterStandalone LANGUAGES CXX)
# --- Import tools ----
include(../cmake/tools.cmake)
# ---- Dependencies ----
include(../cmake/CPM.cmake)
CPMAddPackage(
NAME cxxopts
GITHUB_REPOSITORY jarro2783/cxxopts
VERSION 2.2.0
OPTIONS "CXXOPTS_BUILD_EXAMPLES Off" "CXXOPTS_BUILD_TESTS Off"
)
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
# ---- Create standalone executable ----
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
add_executable(GreeterStandalone ${sources})
set_target_properties(GreeterStandalone PROPERTIES CXX_STANDARD 17 OUTPUT_NAME "Greeter")
# WORKAROUND for ALIAS target is missing error! CK
if(NOT TARGET cxxopts::cxxopts)
add_library(cxxopts::cxxopts ALIAS cxxopts)
endif()
target_link_libraries(GreeterStandalone Greeter::Greeter cxxopts::cxxopts)