-
-
Save sithhell/668c7f76f474980df00abde9af98ac00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 001eac6..14a13bb 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -1098,11 +1098,11 @@ if((MSVC14 AND CMAKE_CL_64) OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) | |
endif() | |
if(MSVC14 AND CMAKE_CL_64) | |
- hpx_add_target_compile_option(-await) | |
+ hpx_add_target_compile_option(-await PUBLIC) | |
endif() | |
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | |
- hpx_add_target_compile_option(-Xclang -fcoroutines-ts) | |
+ hpx_add_target_compile_option(-Xclang -fcoroutines-ts PUBLIC) | |
endif() | |
endif() | |
endif() | |
@@ -1115,11 +1115,11 @@ endif() | |
# optimization flags is not handled here and is left to the responsibility of | |
# the user to avoid conflicts in the resulting binaries | |
-hpx_add_target_compile_definition(_DEBUG CONFIGURATIONS Debug) | |
-hpx_add_target_compile_definition(DEBUG CONFIGURATIONS Debug) | |
-hpx_add_target_compile_definition(HPX_DISABLE_ASSERTS | |
+hpx_add_target_compile_definition(_DEBUG PUBLIC CONFIGURATIONS Debug) | |
+hpx_add_target_compile_definition(DEBUG PUBLIC CONFIGURATIONS Debug) | |
+hpx_add_target_compile_definition(HPX_DISABLE_ASSERTS PUBLIC | |
CONFIGURATIONS Release RelWithDebInfo MinSizeRelease) | |
-hpx_add_target_compile_definition(BOOST_DISABLE_ASSERTS | |
+hpx_add_target_compile_definition(BOOST_DISABLE_ASSERTS PUBLIC | |
CONFIGURATIONS Release RelWithDebInfo MinSizeRelease) | |
# Make sure we compile in proper C++xx mode (MSVC uses it automatically) | |
@@ -1162,8 +1162,8 @@ if(HPX_WITH_CUDA) | |
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-lcudadevrt) | |
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-rdc=true) | |
else() | |
- hpx_add_target_compile_option(-DBOOST_THREAD_USES_MOVE) | |
- hpx_add_target_compile_option(--cuda-path=${CUDA_TOOLKIT_ROOT_DIR}) | |
+ hpx_add_target_compile_option(-DBOOST_THREAD_USES_MOVE PUBLIC) | |
+ hpx_add_target_compile_option(--cuda-path=${CUDA_TOOLKIT_ROOT_DIR} PUBLIC) | |
hpx_libraries(cudart) | |
hpx_library_dir(${CUDA_TOOLKIT_ROOT_DIR}/lib64) | |
link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64) | |
@@ -1276,31 +1276,31 @@ if(WIN32) | |
if(MSVC) | |
enable_language(ASM_MASM) | |
- hpx_add_target_compile_option(-Ox CONFIGURATIONS Release) | |
+ hpx_add_target_compile_option(-Ox PUBLIC CONFIGURATIONS Release) | |
# even VS2017 has an ICE when compiling with -Ob2 | |
- hpx_add_target_compile_option(-Ob1 CONFIGURATIONS Release) | |
+ hpx_add_target_compile_option(-Ob1 PUBLIC CONFIGURATIONS Release) | |
if(NOT HPX_WITH_AWAIT) | |
# /RTC1 is incompatible with /await | |
- hpx_add_target_compile_option(/RTC1 CONFIGURATIONS Debug) | |
+ hpx_add_target_compile_option(/RTC1 PUBLIC CONFIGURATIONS Debug) | |
else() | |
- hpx_remove_target_compile_option(/RTC1 CONFIGURATIONS Debug) | |
+ hpx_remove_target_compile_option(/RTC1 PUBLIC CONFIGURATIONS Debug) | |
endif() | |
# VS2012 and above has a special flag for improving the debug experience by | |
# adding more symbol information to the build (-d2Zi) | |
- hpx_add_target_compile_option(-d2Zi+ CONFIGURATIONS RelWithDebInfo) | |
+ hpx_add_target_compile_option(-d2Zi+ PUBLIC CONFIGURATIONS RelWithDebInfo) | |
# VS2013 and above know how to do link time constant data segment folding | |
# VS2013 update 2 and above know how to remove debug information for | |
# non-referenced functions and data (-Zc:inline) | |
- hpx_add_target_compile_option(-Zc:inline) | |
- hpx_add_target_compile_option(-Gw | |
+ hpx_add_target_compile_option(-Zc:inline PUBLIC) | |
+ hpx_add_target_compile_option(-Gw PUBLIC | |
CONFIGURATIONS Release RelWithDebInfo MinSizeRelease) | |
- hpx_add_target_compile_option(-Zo CONFIGURATIONS RelWithDebInfo) | |
+ hpx_add_target_compile_option(-Zo PUBLIC CONFIGURATIONS RelWithDebInfo) | |
if(HPX_WITH_DATAPAR_VC) | |
- hpx_add_target_compile_option(-std:c++latest) | |
+ hpx_add_target_compile_option(-std:c++latest PUBLIC) | |
hpx_add_config_cond_define(_HAS_AUTO_PTR_ETC 1) | |
endif() | |
@@ -1321,12 +1321,12 @@ if(WIN32) | |
# Update 3 allows to flag rvalue misuses and enforces strict string const- | |
# qualification conformance | |
- hpx_add_target_compile_option(-Zc:rvalueCast) | |
- hpx_add_target_compile_option(-Zc:strictStrings) | |
+ hpx_add_target_compile_option(-Zc:rvalueCast PUBLIC) | |
+ hpx_add_target_compile_option(-Zc:strictStrings PUBLIC) | |
endif() | |
# Runtime type information | |
- hpx_add_target_compile_option(-GR) | |
+ hpx_add_target_compile_option(-GR PUBLIC) | |
# Multiprocessor build | |
hpx_add_target_compile_option(-MP) | |
# Increase the maximum size of object file sections | |
@@ -1338,8 +1338,8 @@ if(WIN32) | |
############################################################################## | |
# Macro definitions for system headers | |
############################################################################## | |
- add_definitions(-D_WINDOWS) | |
- add_definitions(-D_WIN32) | |
+ add_definitions(-D_WINDOWS PUBLIC) | |
+ add_definitions(-D_WIN32 PUBLIC) | |
hpx_add_config_cond_define(_WIN32_WINNT 0x0601) | |
hpx_add_config_cond_define(_SCL_SECURE_NO_WARNINGS) | |
hpx_add_config_cond_define(_CRT_SECURE_NO_WARNINGS) | |
diff --git a/cmake/HPX_AddCompileFlag.cmake b/cmake/HPX_AddCompileFlag.cmake | |
index 5a2bdb4..a4f5a35 100644 | |
--- a/cmake/HPX_AddCompileFlag.cmake | |
+++ b/cmake/HPX_AddCompileFlag.cmake | |
@@ -10,11 +10,16 @@ set_property(GLOBAL PROPERTY HPX_TARGET_COMPILE_DEFINITIONS "") | |
set_property(GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS "") | |
macro(hpx_add_target_compile_option FLAG) | |
- set(options) | |
+ set(options PUBLIC) | |
set(one_value_args) | |
set(multi_value_args CONFIGURATIONS) | |
cmake_parse_arguments(HPX_ADD_TARGET_COMPILE_OPTION "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) | |
+ if(HPX_ADD_TARGET_COMPILE_OPTION_PUBLIC) | |
+ set(_dest HPX_TARGET_COMPILE_OPTIONS_PUBLIC) | |
+ else() | |
+ set(_dest HPX_TARGET_COMPILE_OPTIONS_PRIVATE) | |
+ endif() | |
set(_configurations "none") | |
if(HPX_ADD_TARGET_COMPILE_OPTION_CONFIGURATIONS) | |
set(_configurations "${HPX_ADD_TARGET_COMPILE_OPTION_CONFIGURATIONS}") | |
@@ -25,18 +30,16 @@ macro(hpx_add_target_compile_option FLAG) | |
if(NOT _config STREQUAL "none") | |
set(_conf "$<$<CONFIG:${_config}>:${FLAG}>") | |
endif() | |
- set_property(GLOBAL APPEND PROPERTY HPX_TARGET_COMPILE_OPTIONS "${_conf}") | |
+ set_property(GLOBAL APPEND PROPERTY ${_dest} "${_conf}") | |
endforeach() | |
- get_property(HPX_TARGET_COMPILE_OPTIONS_VAR GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS) | |
- | |
# if(HPX_WITH_CUDA AND (NOT MSVC)) | |
# hpx_add_compile_flag(${FLAG}) | |
# endif() | |
endmacro() | |
macro(hpx_remove_target_compile_option FLAG) | |
- set(options) | |
+ set(options PUBLIC) | |
set(one_value_args) | |
set(multi_value_args CONFIGURATIONS) | |
cmake_parse_arguments(HPX_ADD_TARGET_COMPILE_OPTION "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) | |
@@ -46,30 +49,40 @@ macro(hpx_remove_target_compile_option FLAG) | |
set(_configurations "${HPX_ADD_TARGET_COMPILE_OPTION_CONFIGURATIONS}") | |
endif() | |
- get_property(HPX_TARGET_COMPILE_OPTIONS_VAR GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS) | |
- set_property(GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS "") | |
+ get_property(HPX_TARGET_COMPILE_OPTIONS_PUBLIC_VAR GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS_PUBLIC) | |
+ get_property(HPX_TARGET_COMPILE_OPTIONS_PRIVATE_VAR GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS_PRIVATE) | |
+ set_property(GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS_PUBLIC "") | |
+ set_property(GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS_PRIVATE "") | |
foreach(_config ${_configurations}) | |
set(_conf "${FLAG}") | |
if(NOT _config STREQUAL "none") | |
set(_conf "$<$<CONFIG:${_config}>:${FLAG}>") | |
endif() | |
- foreach(_flag ${HPX_TARGET_COMPILE_OPTIONS_VAR}) | |
+ foreach(_flag ${HPX_TARGET_COMPILE_OPTIONS_PUBLIC_VAR}) | |
+ if(NOT ${_flag} STREQUAL ${_conf}) | |
+ set_property(GLOBAL APPEND PROPERTY HPX_TARGET_COMPILE_OPTIONS_PUBLIC "${_flag}") | |
+ endif() | |
+ endforeach() | |
+ foreach(_flag ${HPX_TARGET_COMPILE_OPTIONS_PRIVATE_VAR}) | |
if(NOT ${_flag} STREQUAL ${_conf}) | |
- set_property(GLOBAL APPEND PROPERTY HPX_TARGET_COMPILE_OPTIONS "${_flag}") | |
+ set_property(GLOBAL APPEND PROPERTY HPX_TARGET_COMPILE_OPTIONS_PRIVATE "${_flag}") | |
endif() | |
endforeach() | |
endforeach() | |
- | |
- get_property(HPX_TARGET_COMPILE_OPTIONS_VAR GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS) | |
endmacro() | |
macro(hpx_add_target_compile_definition FLAG) | |
- set(options) | |
+ set(options PUBLIC) | |
set(one_value_args) | |
set(multi_value_args CONFIGURATIONS) | |
cmake_parse_arguments(HPX_ADD_TARGET_COMPILE_DEFINITION "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) | |
+ if(HPX_ADD_TARGET_COMPILE_DEFINITION_PUBLIC) | |
+ set(_dest HPX_TARGET_COMPILE_DEFINITIONS_PUBLIC) | |
+ else() | |
+ set(_dest HPX_TARGET_COMPILE_DEFINITIONS_PRIVATE) | |
+ endif() | |
set(_configurations "none") | |
if(HPX_ADD_TARGET_COMPILE_DEFINITION_CONFIGURATIONS) | |
set(_configurations "${HPX_ADD_TARGET_COMPILE_DEFINITION_CONFIGURATIONS}") | |
@@ -80,18 +93,15 @@ macro(hpx_add_target_compile_definition FLAG) | |
if(NOT _config STREQUAL "none") | |
set(_conf "$<$<CONFIG:${_config}>:${FLAG}>") | |
endif() | |
- set_property(GLOBAL APPEND PROPERTY HPX_TARGET_COMPILE_DEFINITIONS "${_conf}") | |
+ set_property(GLOBAL APPEND PROPERTY ${_dest} "${_conf}") | |
endforeach() | |
- get_property(HPX_TARGET_COMPILE_DEFINITIONS_VAR GLOBAL PROPERTY HPX_TARGET_COMPILE_DEFINITIONS) | |
- | |
# if(HPX_WITH_CUDA AND (NOT MSVC)) | |
# hpx_add_compile_flag(-D${FLAG}) | |
# endif() | |
endmacro() | |
macro(hpx_add_compile_flag) | |
- set(options) | |
set(one_value_args) | |
set(multi_value_args CONFIGURATIONS LANGUAGES) | |
cmake_parse_arguments(HPX_ADD_COMPILE_FLAG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) | |
@@ -130,7 +140,6 @@ include(CheckCCompilerFlag) | |
include(CheckCXXCompilerFlag) | |
macro(hpx_add_compile_flag_if_available FLAG) | |
- set(options) | |
set(one_value_args NAME) | |
set(multi_value_args CONFIGURATIONS LANGUAGES) | |
cmake_parse_arguments(HPX_ADD_COMPILE_FLAG_IA "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) | |
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | |
index e51bfc6..8e8cc39 100644 | |
--- a/src/CMakeLists.txt | |
+++ b/src/CMakeLists.txt | |
@@ -243,13 +243,13 @@ endif() | |
# Default unnamed config (not Debug/Release/etc) are in this var | |
get_property(_temp_flags GLOBAL PROPERTY HPX_CMAKE_FLAGS_CXX_) | |
-target_compile_options(hpx PUBLIC ${_temp_flags}) | |
+target_compile_options(hpx PRIVATE ${_temp_flags}) | |
# message("Adding ${_temp_flags}") | |
# Could potentially use CMAKE_CONFIGURATION_TYPES in case a user defined config exists | |
foreach(_config "DEBUG" "RELEASE" "RELWITHDEBINFO" "MINSIZEREL") | |
get_property(_temp_flags GLOBAL PROPERTY HPX_CMAKE_FLAGS_CXX_${_config}) | |
- target_compile_options(hpx PUBLIC $<$<CONFIG:${_config}>:${_temp_flags}>) | |
+ target_compile_options(hpx PRIVATE $<$<CONFIG:${_config}>:${_temp_flags}>) | |
# message("Adding $<$<CONFIG:${_config}>:${_temp_flags}>") | |
endforeach() | |
@@ -337,16 +337,6 @@ if(NOT HPX_WITH_STATIC_LINKING) | |
set(hpx_targets ${hpx_targets} hpx_init) | |
endif() | |
-get_property(HPX_TARGET_COMPILE_DEFINITIONS_VAR | |
- GLOBAL PROPERTY HPX_TARGET_COMPILE_DEFINITIONS) | |
-foreach(_flag ${HPX_TARGET_COMPILE_DEFINITIONS_VAR}) | |
- target_compile_definitions(hpx INTERFACE ${_flag}) | |
- target_compile_definitions(hpx PUBLIC ${_flag}) | |
- if(NOT HPX_WITH_STATIC_LINKING) | |
- target_compile_definitions(hpx_init PUBLIC ${_flag}) | |
- endif() | |
-endforeach() | |
- | |
################################################################################ | |
# libhpx_wrap | |
@@ -382,32 +372,30 @@ if(HPX_WITH_DYNAMIC_HPX_MAIN AND (("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR ( | |
endif() | |
-get_property(HPX_TARGET_COMPILE_DEFINITIONS_VAR | |
- GLOBAL PROPERTY HPX_TARGET_COMPILE_DEFINITIONS) | |
-foreach(_flag ${HPX_TARGET_COMPILE_DEFINITIONS_VAR}) | |
- target_compile_definitions(hpx INTERFACE ${_flag}) | |
- target_compile_definitions(hpx PUBLIC ${_flag}) | |
- if(HPX_WITH_DYNAMIC_HPX_MAIN AND (("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (APPLE))) | |
- target_compile_definitions(hpx_wrap INTERFACE ${_flag}) | |
- target_compile_definitions(hpx_wrap PUBLIC ${_flag}) | |
- endif() | |
- if(NOT HPX_WITH_STATIC_LINKING) | |
- target_compile_definitions(hpx_init PUBLIC ${_flag}) | |
- endif() | |
-endforeach() | |
- | |
-get_property(HPX_TARGET_COMPILE_OPTIONS_VAR | |
- GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS) | |
-foreach(_flag ${HPX_TARGET_COMPILE_OPTIONS_VAR}) | |
- target_compile_options(hpx INTERFACE ${_flag}) | |
- target_compile_options(hpx PUBLIC ${_flag}) | |
- if(HPX_WITH_DYNAMIC_HPX_MAIN AND (("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (APPLE))) | |
- target_compile_options(hpx_wrap INTERFACE ${_flag}) | |
- target_compile_options(hpx_wrap PUBLIC ${_flag}) | |
- endif() | |
- if(NOT HPX_WITH_STATIC_LINKING) | |
- target_compile_options(hpx_init PUBLIC ${_flag}) | |
- endif() | |
+foreach(_keyword PUBLIC;PRIVATE) | |
+ get_property(HPX_TARGET_COMPILE_DEFINITIONS_VAR | |
+ GLOBAL PROPERTY HPX_TARGET_COMPILE_DEFINITIONS_${_keyword}) | |
+ foreach(_flag ${HPX_TARGET_COMPILE_DEFINITIONS_VAR}) | |
+ target_compile_definitions(hpx ${_keyword} ${_flag}) | |
+ if(HPX_WITH_DYNAMIC_HPX_MAIN AND (("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (APPLE))) | |
+ target_compile_definitions(hpx_wrap ${_keyword} ${_flag}) | |
+ endif() | |
+ if(NOT HPX_WITH_STATIC_LINKING) | |
+ target_compile_definitions(hpx_init ${_keyword} ${_flag}) | |
+ endif() | |
+ endforeach() | |
+ | |
+ get_property(HPX_TARGET_COMPILE_OPTIONS_VAR | |
+ GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS_${_keyword}) | |
+ foreach(_flag ${HPX_TARGET_COMPILE_OPTIONS_VAR}) | |
+ target_compile_options(hpx ${_keyword} ${_flag}) | |
+ if(HPX_WITH_DYNAMIC_HPX_MAIN AND (("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (APPLE))) | |
+ target_compile_options(hpx_wrap ${_keyword} ${_flag}) | |
+ endif() | |
+ if(NOT HPX_WITH_STATIC_LINKING) | |
+ target_compile_options(hpx_init ${_keyword} ${_flag}) | |
+ endif() | |
+ endforeach() | |
endforeach() | |
set(_optional) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment