2023-12-21 11:27:19 +03:00
|
|
|
option(CMAKE_COLOR_MAKEFILE "colorful CMake makefile" ON)
|
|
|
|
option(CMAKE_VERBOSE_MAKEFILE "verbose CMake makefile" ON)
|
|
|
|
option(CMAKE_POSITION_INDEPENDENT_CODE "build with position independent code (-fPIC or -fPIE)" ON)
|
|
|
|
option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON)
|
|
|
|
option(WITH_BINARY_VERSIONING "Use binary versioning" OFF)
|
|
|
|
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
|
|
|
|
2024-08-29 09:44:39 +03:00
|
|
|
# We want to control the winpr assert for the whole project
|
|
|
|
option(WITH_VERBOSE_WINPR_ASSERT "Compile with verbose WINPR_ASSERT." ON)
|
|
|
|
if (WITH_VERBOSE_WINPR_ASSERT)
|
|
|
|
add_definitions(-DWITH_VERBOSE_WINPR_ASSERT)
|
|
|
|
endif()
|
|
|
|
|
2023-12-22 16:26:40 +03:00
|
|
|
# known issue on android, thus disabled until we support newer CMake
|
|
|
|
# https://github.com/android/ndk/issues/1444
|
|
|
|
if (NOT ANDROID)
|
2024-02-13 17:48:33 +03:00
|
|
|
if(POLICY CMP0069)
|
|
|
|
cmake_policy(SET CMP0069 NEW)
|
|
|
|
endif()
|
|
|
|
if(POLICY CMP0138)
|
2024-01-24 16:02:57 +03:00
|
|
|
cmake_policy(SET CMP0138 NEW)
|
|
|
|
endif()
|
2023-12-22 16:26:40 +03:00
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported(RESULT supported OUTPUT error)
|
|
|
|
if (NOT supported)
|
|
|
|
message(WARNING "LTO not supported, got ${error}")
|
|
|
|
endif()
|
2023-12-21 11:27:19 +03:00
|
|
|
|
2023-12-22 16:26:40 +03:00
|
|
|
option(CMAKE_INTERPROCEDURAL_OPTIMIZATION "build with link time optimization" ${supported})
|
|
|
|
endif()
|
2023-12-21 11:27:19 +03:00
|
|
|
|
|
|
|
# Default to release build type
|
2024-10-17 16:54:41 +03:00
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
# Set a default build type if none was specified
|
|
|
|
set(default_build_type "Release")
|
|
|
|
|
|
|
|
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" "MinSizeRel" "RelWithDebInfo")
|
2023-12-21 11:27:19 +03:00
|
|
|
endif()
|
|
|
|
|
2024-03-19 11:51:11 +03:00
|
|
|
include(PlatformDefaults)
|
2023-12-21 11:27:19 +03:00
|
|
|
include(PreventInSourceBuilds)
|
|
|
|
include(GNUInstallDirsWrapper)
|
|
|
|
include(MSVCRuntime)
|
|
|
|
include(ConfigureRPATH)
|
2024-01-23 16:40:13 +03:00
|
|
|
include(ClangTidy)
|
2024-03-19 14:19:07 +03:00
|
|
|
include(AddTargetWithResourceFile)
|
2024-08-27 10:03:44 +03:00
|
|
|
include(DisableCompilerWarnings)
|
2024-10-02 23:37:35 +03:00
|
|
|
include(CleaningConfigureFile)
|