2014-10-17 21:23:00 -04:00
|
|
|
function(sm_append_simple_target_property target property str)
|
|
|
|
|
get_target_property(current_property ${target} ${property})
|
2019-02-16 11:32:52 -05:00
|
|
|
if(current_property)
|
2014-10-17 21:23:00 -04:00
|
|
|
list(APPEND current_property ${str})
|
2019-02-16 11:32:52 -05:00
|
|
|
set_target_properties(${target}
|
|
|
|
|
PROPERTIES ${property} "${current_property}")
|
2014-10-17 21:23:00 -04:00
|
|
|
else()
|
|
|
|
|
set_target_properties(${target} PROPERTIES ${property} ${str})
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
function(sm_add_link_flag target flag)
|
2019-02-16 11:32:52 -05:00
|
|
|
if(MSVC)
|
2014-10-17 21:23:00 -04:00
|
|
|
# Use a modified form of sm_append_simple_target_property.
|
2015-04-18 13:58:16 -04:00
|
|
|
get_target_property(current_property ${target} LINK_FLAGS)
|
2019-02-16 11:32:52 -05:00
|
|
|
if(current_property)
|
|
|
|
|
set_target_properties(${target}
|
|
|
|
|
PROPERTIES LINK_FLAGS "${current_property} ${flag}")
|
2015-04-18 13:58:16 -04:00
|
|
|
else()
|
|
|
|
|
set_target_properties(${target} PROPERTIES LINK_FLAGS ${flag})
|
|
|
|
|
endif()
|
2014-10-17 21:23:00 -04:00
|
|
|
else()
|
|
|
|
|
sm_append_simple_target_property(${target} LINK_FLAGS ${flag})
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
function(disable_project_warnings projectName)
|
2019-02-16 11:32:52 -05:00
|
|
|
if(NOT WITH_EXTERNAL_WARNINGS)
|
|
|
|
|
if(MSVC)
|
2022-03-20 00:25:50 +01:00
|
|
|
target_compile_options(${projectName} PRIVATE "/W0")
|
2022-04-08 22:46:43 +02:00
|
|
|
elseif(CMAKE_GENERATOR STREQUAL Xcode)
|
2022-03-20 00:25:50 +01:00
|
|
|
set_property(TARGET ${projectName} PROPERTY XCODE_ATTRIBUTE_GCC_WARN_INHIBIT_ALL_WARNINGS "YES")
|
2015-04-05 14:49:10 -04:00
|
|
|
else()
|
2022-03-20 00:25:50 +01:00
|
|
|
target_compile_options(${projectName} PRIVATE "-w")
|
2015-04-05 14:49:10 -04:00
|
|
|
endif()
|
2014-10-17 21:23:00 -04:00
|
|
|
endif()
|
|
|
|
|
endfunction()
|
2015-09-05 13:14:44 -04:00
|
|
|
|
2019-02-16 11:32:52 -05:00
|
|
|
macro(check_compile_features
|
|
|
|
|
BIN_DIR
|
|
|
|
|
SOURCE_FILE
|
|
|
|
|
GREETER
|
|
|
|
|
GREET_SUCCESS
|
|
|
|
|
GREET_FAILURE
|
|
|
|
|
TARGET_VAR
|
|
|
|
|
ON_SUCCESS)
|
2015-09-13 13:10:58 -04:00
|
|
|
if(NOT DEFINED "${TARGET_VAR}")
|
|
|
|
|
message(STATUS "${GREETER}")
|
2019-02-16 11:32:52 -05:00
|
|
|
try_compile(${TARGET_VAR} "${BIN_DIR}" SOURCES "${SOURCE_FILE}")
|
2015-09-13 13:10:58 -04:00
|
|
|
if(${TARGET_VAR})
|
2019-02-16 11:32:52 -05:00
|
|
|
if(${ON_SUCCESS})
|
2015-09-13 13:10:58 -04:00
|
|
|
message(STATUS "${GREETER} - ${GREET_SUCCESS}")
|
|
|
|
|
set(${TARGET_VAR} 1 CACHE INTERNAL "${GREETER}")
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "${GREETER} - ${GREET_FAILURE}")
|
|
|
|
|
set(${TARGET_VAR} "" CACHE INTERNAL "${GREETER}")
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
if(${ON_SUCCESS})
|
|
|
|
|
message(STATUS "${GREETER} - ${GREET_FAILURE}")
|
|
|
|
|
set(${TARGET_VAR} 1 CACHE INTERNAL "${GREETER}")
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "${GREETER} - ${GREET_SUCCESS}")
|
|
|
|
|
set(${TARGET_VAR} "" CACHE INTERNAL "${GREETER}")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
endmacro()
|