Fixes c++26 issues and cleans up feature messages
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# Test actual compilation of C++26 code
|
||||
@@ -10,4 +8,10 @@ struct A {
|
||||
};
|
||||
int main() { A a,b; return (a <=> b) == 0 ? 0 : 1; }
|
||||
" HAS_CXX26)
|
||||
set(CMAKE_REQUIRED_FLAGS "") # reset
|
||||
set(CMAKE_REQUIRED_FLAGS "") # reset
|
||||
|
||||
if (HAS_CXX26)
|
||||
message("-- C++26: ON")
|
||||
else ()
|
||||
message("-- C++26: OFF")
|
||||
endif ()
|
||||
@@ -8,7 +8,7 @@ try_compile(HAS_CPP_REFLECTION
|
||||
)
|
||||
|
||||
if (HAS_CPP_REFLECTION)
|
||||
message(STATUS "Compiler supports C++ reflection")
|
||||
message(STATUS "C++26 Reflection: ON")
|
||||
else ()
|
||||
message(STATUS "Compiler does NOT support C++ reflection")
|
||||
message(STATUS "C++26 Reflection: OFF")
|
||||
endif ()
|
||||
@@ -23,9 +23,11 @@ function(ConfigureFGLTarget NAME SRC_DIR INCLUDE_DIR)
|
||||
target_compile_definitions(${NAME} PUBLIC "-DFGL_STRICT_WARNINGS=1")
|
||||
endif ()
|
||||
|
||||
if (HAS_CXX26)
|
||||
if (CMAKE_CXX_STANDARD STREQUAL 26)
|
||||
message("Setting target ${NAME} to c++26")
|
||||
target_compile_features(${NAME} PUBLIC cxx_std_26)
|
||||
else ()
|
||||
message("Setting target ${NAME} to c++23")
|
||||
target_compile_features(${NAME} PUBLIC cxx_std_23)
|
||||
endif ()
|
||||
endfunction()
|
||||
@@ -42,16 +44,13 @@ function(SplitDebugSymbols NAME)
|
||||
endfunction()
|
||||
|
||||
function(AddFGLExecutable NAME SRC_SOURCES_LOCATION)
|
||||
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
|
||||
${SRC_SOURCES_LOCATION}/**.cpp
|
||||
${SRC_SOURCES_LOCATION}/**.hpp
|
||||
)
|
||||
file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp)
|
||||
file(GLOB_RECURSE HPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.hpp)
|
||||
|
||||
file(GLOB_RECURSE UI_SOURCES CONFIGURE_DEPENDS
|
||||
${SRC_SOURCES_LOCATION}/**.ui)
|
||||
file(GLOB_RECURSE UI_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.ui)
|
||||
|
||||
add_executable(${NAME} ${SOURCES})
|
||||
target_sources(${NAME} PUBLIC ${SOURCES})
|
||||
add_executable(${NAME})
|
||||
target_sources(${NAME} PRIVATE ${CPP_SOURCES})
|
||||
|
||||
ConfigureFGLTarget(${NAME} ${SRC_SOURCES_LOCATION} "")
|
||||
|
||||
@@ -67,16 +66,13 @@ function(AddFGLExecutable NAME SRC_SOURCES_LOCATION)
|
||||
endfunction()
|
||||
|
||||
function(AddFGLLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION)
|
||||
|
||||
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
|
||||
${SRC_SOURCES_LOCATION}/**.cpp
|
||||
${SRC_SOURCES_LOCATION}/**.hpp
|
||||
)
|
||||
file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp)
|
||||
file(GLOB_RECURSE HPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.hpp)
|
||||
|
||||
file(GLOB_RECURSE INCLUDE_HPP_SOURCES CONFIGURE_DEPENDS ${INCLUDE_SOURCES_LOCATION}/**.hpp)
|
||||
|
||||
add_library(${NAME} ${MODE})
|
||||
target_sources(${NAME} PRIVATE ${SOURCES})
|
||||
target_sources(${NAME} PRIVATE ${CPP_SOURCES} ${HPP_SOURCES})
|
||||
|
||||
ConfigureFGLTarget(${NAME} ${SRC_SOURCES_LOCATION} ${INCLUDE_SOURCES_LOCATION})
|
||||
|
||||
@@ -98,12 +94,14 @@ function(AddFGLModule NAME SRC_SOURCES_LOCATION)
|
||||
AddGitInfo(${NAME})
|
||||
target_compile_definitions(${NAME} PRIVATE FGL_BUILD_TYPE="${CMAKE_BUILD_TYPE}")
|
||||
|
||||
ConfigureFGLTarget(${NAME} ${SRC_SOURCES_LOCATION} "")
|
||||
|
||||
SplitDebugSymbols(${NAME})
|
||||
endfunction()
|
||||
|
||||
function(AddFGLChildLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION)
|
||||
file(GLOB_RECURSE CPP_SOURCES ${SRC_SOURCES_LOCATION}/**.cpp)
|
||||
file(GLOB_RECURSE HPP_SOURCES ${SRC_SOURCES_LOCATION}/**.hpp)
|
||||
file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp)
|
||||
file(GLOB_RECURSE HPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.hpp)
|
||||
file(GLOB_RECURSE INCLUDE_HPP_SOURCES ${INCLUDE_SOURCES_LOCATION}/**.hpp)
|
||||
add_library(${NAME} ${MODE} ${CPP_SOURCES} ${HPP_SOURCES} ${INCLUDE_SOURCES_LOCATION})
|
||||
target_include_directories(${NAME} PUBLIC ${INCLUDE_SOURCES_LOCATION})
|
||||
|
||||
Reference in New Issue
Block a user