-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (45 loc) · 1.58 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
cmake_minimum_required(VERSION 3.25)
set(VCPKG_FMT_TEMPLATE_VERSION 0.1.2)
project(vcpkg-fmt-template VERSION ${VCPKG_FMT_TEMPLATE_VERSION} LANGUAGES CXX)
# Set default build to release
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
endif ()
# Compiler config
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# make sure __cplusplus is defined when using msvc and enable parallel build
if (MSVC)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus /MP")
endif ()
set(CMAKE_CXX_EXTENSIONS OFF)
if (CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS")
set(CMAKE_CXX_EXTENSIONS ON)
endif ()
# warning options
option(VCPKG_FMT_TEMPLATE_BUILD_WARNINGS "Enable compiler warnings" OFF)
include(GNUInstallDirs)
# Define helper functions and macros used by occutils
include(cmake/internal_utils.cmake)
# Licensing
build_3rd_party_copyright()
# Dependencies
find_package(fmt CONFIG REQUIRED)
# Set libs to link against
list(APPEND VCPKG_FMT_TEMPLATE_LIBS fmt::fmt)
# Build
cxx_executable(${PROJECT_NAME} src "${VCPKG_FMT_TEMPLATE_LIBS}")
if (VCPKG_FMT_TEMPLATE_BUILD_WARNINGS)
target_enable_warnings(${PROJECT_NAME})
endif ()
# Configure install
include(InstallRequiredSystemLibraries)
install(TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES
${CMAKE_CURRENT_LIST_DIR}/README.md
${CMAKE_CURRENT_LIST_DIR}/LICENSE
${CMAKE_BINARY_DIR}/LICENSE-3RD-PARTY.txt
DESTINATION ${CMAKE_INSTALL_DOCDIR})
# Packaging
include(cmake/vcpkg-fmt-template-cpack.cmake)