forked from wxWidgets/wxWidgets
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
105 lines (90 loc) · 4.01 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#############################################################################
# Name: CMakeLists.txt
# Purpose: Primary CMake for wxWidgets
# Author: Tobias Taschner
# Created: 2016-09-20
# Copyright: (c) 2016 wxWidgets development team
# Licence: wxWindows licence
#############################################################################
cmake_minimum_required(VERSION 3.5)
if(NOT CMAKE_CONFIGURATION_TYPES)
get_property(HAVE_MULTI_CONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
# Set default configuration types for multi-config generators
if(HAVE_MULTI_CONFIG_GENERATOR)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
endif()
endif()
file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX)
# https://blog.kitware.com/cmake-and-the-default-build-type/
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(default_build_type "Debug")
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif()
# This block, particularly the versions used, should be kept in sync with
# samples/minimal/CMakeLists.txt.
if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
# If no deployment target has been set default to the minimum supported
# OS version (this has to be set before the first project() call)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0 CACHE STRING "iOS Deployment Target")
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "macOS Deployment Target")
endif()
endif()
include(build/cmake/policies.cmake NO_POLICY_SCOPE)
# Initialize variables for quick access to wx root dir in sub dirs
set(wxSOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(wxBINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(wxOUTPUT_DIR ${wxBINARY_DIR}/lib)
# parse the version number from wx/version.h and include in wxMAJOR_VERSION and wxMINOR_VERSION
file(READ "${wxSOURCE_DIR}/include/wx/version.h" WX_VERSION_H_CONTENTS)
string(REGEX MATCH "wxMAJOR_VERSION[ \t]+([0-9]+)"
wxMAJOR_VERSION ${WX_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)"
wxMAJOR_VERSION ${wxMAJOR_VERSION})
string(REGEX MATCH "wxMINOR_VERSION[ \t]+([0-9]+)"
wxMINOR_VERSION ${WX_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)"
wxMINOR_VERSION ${wxMINOR_VERSION})
string(REGEX MATCH "wxRELEASE_NUMBER[ \t]+([0-9]+)"
wxRELEASE_NUMBER ${WX_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)"
wxRELEASE_NUMBER ${wxRELEASE_NUMBER})
# Determine if current version is a "Development" release
math(EXPR rel_dev "${wxMINOR_VERSION} % 2")
if(rel_dev)
set(wxVERSION_IS_DEV TRUE)
else()
set(wxVERSION_IS_DEV FALSE)
endif()
# parse the .so version from build/bakefiles/version.bkl
file(READ "${wxSOURCE_DIR}/build/bakefiles/version.bkl" WX_VERSION_BKL_CONTENTS)
string(REGEX MATCH "WX_CURRENT.>([0-9]+)"
WX_CURRENT ${WX_VERSION_BKL_CONTENTS})
string(REGEX MATCH "([0-9]+)"
WX_CURRENT ${WX_CURRENT})
string(REGEX MATCH "WX_REVISION.>([0-9]+)"
WX_REVISION ${WX_VERSION_BKL_CONTENTS})
string(REGEX MATCH "([0-9]+)"
WX_REVISION ${WX_REVISION})
string(REGEX MATCH "WX_AGE.>([0-9]+)"
WX_AGE ${WX_VERSION_BKL_CONTENTS})
string(REGEX MATCH "([0-9]+)"
WX_AGE ${WX_AGE})
math(EXPR wxSOVERSION_MAJOR "${WX_CURRENT} - ${WX_AGE}")
set(wxSOVERSION ${wxSOVERSION_MAJOR}.${WX_AGE}.${WX_REVISION})
set(wxVERSION ${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER})
set(wxCOPYRIGHT "2002-2024 wxWidgets")
set(wxLANGUAGES C CXX)
if(APPLE AND NOT CMAKE_VERSION VERSION_LESS "3.16")
list(APPEND wxLANGUAGES OBJCXX)
endif()
project(wxWidgets VERSION ${wxVERSION} LANGUAGES ${wxLANGUAGES})
include(build/cmake/main.cmake)
# Set the default startup project for Visual Studio
if(wxBUILD_SAMPLES AND wxUSE_GUI)
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT minimal)
endif()