forked from fnc12/sqlite_orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (58 loc) · 2.46 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
cmake_minimum_required (VERSION 3.2)
cmake_policy(SET CMP0057 NEW)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# PACKAGE_VERSION is used by cpack scripts currently
# Both sqlite_orm_VERSION and PACKAGE_VERSION should be the same for now
set(sqlite_orm_VERSION "1.3.0")
set(PACKAGE_VERSION ${sqlite_orm_VERSION})
project("sqlite_orm" VERSION ${PACKAGE_VERSION})
set(CMAKE_VERBOSE_MAKEFILE ON)
message(STATUS "Configuring ${CMAKE_PROJECT_NAME} ${sqlite_orm_VERSION}")
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
# Build time options are defined here
include(DefineInstallationPaths)
# Generate the SqliteOrmConfig.cmake module
include(GenerateConfigModule)
set(ProjectName "SqliteOrm")
option(SqliteOrm_BuildTests "Build sqlite_orm unit tests" ON)
set(SqliteOrm_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/include")
add_library(sqlite_orm INTERFACE)
target_sources(sqlite_orm INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/sqlite_orm/sqlite_orm.h>
$<INSTALL_INTERFACE:include/sqlite_orm/sqlite_orm.h>)
target_include_directories(sqlite_orm INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
include(ucm)
if (MSVC)
string(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
add_compile_options(/EHsc)
if ("${CMAKE_GENERATOR}" MATCHES "(Win64|x64)")
message(STATUS "Add /bigobj flag to compiler")
add_compile_options(/bigobj)
endif()
endif()
ucm_print_flags()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
# Tests
include(CTest)
if(SqliteOrm_BuildTests AND BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
add_subdirectory(examples)
install(TARGETS sqlite_orm EXPORT "${ProjectName}Targets"
INCLUDES DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development
PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development)
install(FILES "include/sqlite_orm/sqlite_orm.h"
DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development)
export(EXPORT "${ProjectName}Targets"
FILE "${CMAKE_CURRENT_BINARY_DIR}/${ProjectName}/${ProjectName}Targets.cmake"
NAMESPACE "sqlite_orm::")
install(EXPORT "${ProjectName}Targets"
FILE "${ProjectName}Targets.cmake"
NAMESPACE "sqlite_orm::"
DESTINATION "${CMAKE_INSTALL_DIR}/sqlite_orm")