mirror of
https://github.com/gbdev/rgbds.git
synced 2026-03-25 14:23:04 +00:00
Reorder CMakeLists commands by topic
This commit is contained in:
@@ -31,6 +31,8 @@ endif()
|
|||||||
include(CTest) # Note: CTest only functions properly if included from the top-level CMakeLists.
|
include(CTest) # Note: CTest only functions properly if included from the top-level CMakeLists.
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
## Compiler switches.
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
option(SANITIZERS "Build with sanitizers enabled" OFF)
|
option(SANITIZERS "Build with sanitizers enabled" OFF)
|
||||||
cmake_dependent_option(MORE_WARNINGS "Turn on more warnings" OFF !MSVC OFF)
|
cmake_dependent_option(MORE_WARNINGS "Turn on more warnings" OFF !MSVC OFF)
|
||||||
@@ -79,8 +81,25 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use versioning consistent with Makefile
|
include_directories("include")
|
||||||
# the git revision is used but uses the fallback in an archive
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
|
message(CHECK_START "Checking if LTO is supported")
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT enable_lto)
|
||||||
|
if(enable_lto)
|
||||||
|
message(CHECK_PASS "yes")
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON)
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON)
|
||||||
|
else()
|
||||||
|
message(CHECK_FAIL "no")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Use versioning consistent with Makefile:
|
||||||
|
# the git revision is used but uses the fallback in an archive.
|
||||||
|
|
||||||
message(CHECK_START "Determining RGBDS version from Git history")
|
message(CHECK_START "Determining RGBDS version from Git history")
|
||||||
list(APPEND CMAKE_MESSAGE_INDENT " ")
|
list(APPEND CMAKE_MESSAGE_INDENT " ")
|
||||||
@@ -115,6 +134,8 @@ Version mismatch! Git says ${CMAKE_MATCH_0},
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
## Dependencies.
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
if(MSVC OR NOT PKG_CONFIG_FOUND)
|
if(MSVC OR NOT PKG_CONFIG_FOUND)
|
||||||
# fallback to find_package
|
# fallback to find_package
|
||||||
@@ -126,22 +147,7 @@ else()
|
|||||||
add_library(PNG::PNG ALIAS PkgConfig::LIBPNG)
|
add_library(PNG::PNG ALIAS PkgConfig::LIBPNG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories("include")
|
## The actual stuff.
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
||||||
|
|
||||||
message(CHECK_START "Checking if LTO is supported")
|
|
||||||
include(CheckIPOSupported)
|
|
||||||
check_ipo_supported(RESULT enable_lto)
|
|
||||||
if(enable_lto)
|
|
||||||
message(CHECK_PASS "yes")
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON)
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON)
|
|
||||||
else()
|
|
||||||
message(CHECK_FAIL "no")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|||||||
Reference in New Issue
Block a user