Private
Public Access
2
0

Modification des règles de cmake_policy()

SwigNode ne peut toujours pas être compilé
This commit is contained in:
2026-05-01 19:42:28 +02:00
parent fbeaa766d1
commit 3be46c12b8

View File

@@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 4.0)
project (mraa C)
cmake_policy(SET CMP0177 NEW)
#cmake_policy(SET CMP0148 NEW)
cmake_policy(SET CMP0148 NEW)
FIND_PACKAGE (Threads REQUIRED)
@@ -78,17 +78,22 @@ if (BUILDCPP)
endif ()
endforeach ()
#-----------------------------------------------------------------
# This function adds the c++20 flag to a c++ target (if supported)
function(use_cxx_20 targetname)
#function(use_cxx_20 targetname)
message(STATUS "\nInside function")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++20" COMPILER_SUPPORTS_CXX20)
CHECK_CXX_COMPILER_FLAG(-std=c++23 COMPILER_SUPPORTS_CXX20)
message(STATUS "check result ${COMPILER_SUPPORTS_CXX20}")
if (COMPILER_SUPPORTS_CXX20)
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++20")
message(STATUS "INFO Use std=c++20")
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++23")
message(STATUS "INFO Use std=c++23")
else()
message(FATAL_ERROR "Target '${targetname}' requires c++20 which is not supported by this compiler")
endif()
endfunction()
#endfunction()
#------------------------------------------------------------------
# # This function adds the c++17 flag to a c++ target (if supported)
# function(use_cxx_17 targetname)