if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) # link to full path of libs cmake_policy(SET CMP0005 NEW) # escapes in add_definitions 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() endif() set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) if(WIN32) include(RemoveStrawberryPerlFromPATH) endif() if(UPDATE_APPCAST) include(UpdateAppcast) endif() if(TAG_RELEASE) include(MakeReleaseCommitAndTag) endif() set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext wxwidgets) set(VCPKG_DEPS_OPTIONAL sfml ENABLE_LINK ffmpeg ENABLE_FFMPEG ) 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) message(STATUS "Enabling ccache") set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "C compiler launcher" FORCE) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "C++ compiler launcher" FORCE) set(CMAKE_ASM_NASM_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE} CACHE STRING "nasm assembler launcher" FORCE) endif() endif() cmake_minimum_required(VERSION 3.8.2) set(CMAKE_CXX_STANDARD 17) project(VBA-M C CXX) if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL ""))) set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}") endif() if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE) elseif(NOT CMAKE_BUILD_TYPE MATCHES "^(Release|Debug|RelWithDebInfo|MinSizeRel)$") message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}', must be one of: 'Release', 'Debug', 'RelWithDebInfo' or 'MinSizeRel'") endif() # Link debug libs for RelWithDebInfo if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Debug") endif() include(CTest) if(BUILD_TESTING) enable_testing() endif() set(ALL_TARGETS fex visualboyadvance-m vbamcore vbam) 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=