From 9f9a40100f13a0b8e8b0703a9b034184c47244ed Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Oct 2019 16:32:21 +0200 Subject: [PATCH 1/3] Solve build fail in RelWithDebInfo config with several imported targets. --- CMakeLists.txt | 27 ++++++++++++++++++++------- src/qhull/CMakeLists.txt | 4 +++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96752abb8..2d620f869 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,7 +255,8 @@ if(NOT WIN32) # boost::process was introduced first in version 1.64.0 set(MINIMUM_BOOST_VERSION "1.64.0") endif() -find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex) +set(_boost_components "system;filesystem;thread;log;locale;regex") +find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components}) add_library(boost_libs INTERFACE) add_library(boost_headeronly INTERFACE) @@ -269,23 +270,35 @@ if(NOT SLIC3R_STATIC) target_compile_definitions(boost_headeronly INTERFACE BOOST_LOG_DYN_LINK) endif() +function(slic3r_remap_configs targets from_Cfg to_Cfg) + string(TOUPPER ${from_Cfg} from_CFG) + string(TOLOWER ${from_Cfg} from_cfg) + + message(STATUS "remapping targets: ${targets}") + foreach(tgt ${targets}) + if(TARGET ${tgt}) + set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg}) + message(STATUS "remap ${tgt} from ${from_Cfg} to ${to_Cfg}") + endif() + endforeach() +endfunction() + if(TARGET Boost::system) message(STATUS "Boost::boost exists") target_link_libraries(boost_headeronly INTERFACE Boost::boost) + list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets) target_link_libraries(boost_libs INTERFACE boost_headeronly # includes the custom compile definitions as well - Boost::system - Boost::filesystem - Boost::thread - Boost::log - Boost::locale - Boost::regex + ${_boost_targets} ) + slic3r_remap_configs("${_boost_targets}" RelWithDebInfo Release) else() target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS}) target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES}) endif() + + # Find and configure intel-tbb if(SLIC3R_STATIC) set(TBB_STATIC 1) diff --git a/src/qhull/CMakeLists.txt b/src/qhull/CMakeLists.txt index 9ca0bdff2..ab9aba9af 100644 --- a/src/qhull/CMakeLists.txt +++ b/src/qhull/CMakeLists.txt @@ -18,11 +18,13 @@ if(Qhull_FOUND) message(STATUS "Using qhull from system.") if(SLIC3R_STATIC) + slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhullstatic_r" RelWithDebInfo Release) target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhullstatic_r) else() + slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhull_r" RelWithDebInfo Release) target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhull_r) endif() - + else(Qhull_FOUND) project(qhull) From 7f0c4fafe6677c32dc4ae09d512f2ee2f242fa45 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Oct 2019 16:42:40 +0200 Subject: [PATCH 2/3] Remove cmake debug messages --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d620f869..31d2b7c8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,11 +274,9 @@ function(slic3r_remap_configs targets from_Cfg to_Cfg) string(TOUPPER ${from_Cfg} from_CFG) string(TOLOWER ${from_Cfg} from_cfg) - message(STATUS "remapping targets: ${targets}") foreach(tgt ${targets}) if(TARGET ${tgt}) set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg}) - message(STATUS "remap ${tgt} from ${from_Cfg} to ${to_Cfg}") endif() endforeach() endfunction() From 8961e68f5ed2b2fe969c61cd06158c7384c9dbdb Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Oct 2019 17:04:32 +0200 Subject: [PATCH 3/3] another cleanup --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31d2b7c8a..dde5a51f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,7 +272,6 @@ endif() function(slic3r_remap_configs targets from_Cfg to_Cfg) string(TOUPPER ${from_Cfg} from_CFG) - string(TOLOWER ${from_Cfg} from_cfg) foreach(tgt ${targets}) if(TARGET ${tgt})