diff --git a/CMakeLists.txt b/CMakeLists.txt index 74ca73e1..6af4a332 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,34 +1,10 @@ -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) # link to full path of libs - cmake_policy(SET CMP0005 NEW) # escapes in add_definitions +cmake_minimum_required(VERSION 3.19) - if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) # use Package_ROOT if set - endif() - - if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) # use vars for options - endif() - - if(POLICY CMP0043) - cmake_policy(SET CMP0043 NEW) # for wxWidgets, use generator expressions - endif() - - if(POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) # set CMAKE_PROJECT_VERSION* - endif() - - if(POLICY CMP0011) - cmake_policy(SET CMP0011 NEW) # Policy PUSH/POP for scripts. - endif() - - if(POLICY CMP0012) - cmake_policy(SET CMP0012 NEW) # Saner if() behavior. - endif() - - if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) # Full lib paths. - endif() +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) # use Package_ROOT if set +endif() +if(POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) # use vars for options endif() set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) @@ -63,15 +39,8 @@ endif() include(Set-Toolchain-vcpkg) -set(VBAM_STATIC_DEFAULT OFF) - -if(VCPKG_TARGET_TRIPLET MATCHES -static OR CMAKE_TOOLCHAIN_FILE MATCHES "mxe|-static") - set(VBAM_STATIC_DEFAULT ON) -endif() - # Use ccache if available and not already enabled on the command line. # This has to be done before the project() call. - if(NOT CMAKE_CXX_COMPILER_LAUNCHER) find_program(CCACHE_EXECUTABLE ccache) if(CCACHE_EXECUTABLE) @@ -83,12 +52,17 @@ if(NOT CMAKE_CXX_COMPILER_LAUNCHER) endif() endif() -cmake_minimum_required(VERSION 3.8.2) - set(CMAKE_CXX_STANDARD 17) project(VBA-M C CXX) +find_package(Git) +find_package(PkgConfig) + +include(GNUInstallDirs) +include(Options) +include(Architecture) + if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL ""))) set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}") endif() @@ -105,7 +79,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") endif() include(CTest) - if(BUILD_TESTING) enable_testing() endif() @@ -117,144 +90,10 @@ add_custom_target(generate) #Output all binaries at top level set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}) -option(ENABLE_SDL "Build the SDL port" OFF) -option(ENABLE_WX "Build the wxWidgets port" ON) -option(ENABLE_DEBUGGER "Enable the debugger" ON) -option(ENABLE_ASAN "Enable -fsanitize=