Skip to content

Commit

Permalink
Fix build error when Boost CONFIG_MACRO is the last of the CMAKE_ARGS (
Browse files Browse the repository at this point in the history
  • Loading branch information
ibasurto authored and caseymcc committed Feb 8, 2018
1 parent 36416a2 commit 0a4fc16
Show file tree
Hide file tree
Showing 34 changed files with 274 additions and 68 deletions.
22 changes: 22 additions & 0 deletions cmake/modules/hunter_parse_boost_config_macros.cmake
@@ -0,0 +1,22 @@
function(hunter_parse_boost_config_macros outvar)
# parse ARGN to convert 'CONFIG_MACRO=id1;id2;CONFIG_MACRO_id3=3' to 'id1;id2;id3=3'
unset(boost_config_macros_list)
set(config_macros_without_value_mode FALSE)
foreach(arg ${ARGN})
if ("${arg}" MATCHES "[^=]+=.+")
set(config_macros_without_value_mode FALSE)
endif()
if(config_macros_without_value_mode)
# CONFIG_MACRO=id_1 id_2 ... id_n -> APPEND id_n
list(APPEND boost_config_macros_list "${arg}")
elseif("${arg}" MATCHES "^CONFIG_MACRO=(.+)" )
# CONFIG_MACRO=id_1 id_2 ... id_n -> APPEND id_1
list(APPEND boost_config_macros_list "${CMAKE_MATCH_1}")
set(config_macros_without_value_mode TRUE)
elseif("${arg}" MATCHES "^CONFIG_MACRO_([^=]+=.+)" )
# CONFIG_MACRO_id=val -> APPEND id=val
list(APPEND boost_config_macros_list "${CMAKE_MATCH_1}")
endif()
endforeach()
set(${outvar} ${boost_config_macros_list} PARENT_SCOPE)
endfunction()
2 changes: 1 addition & 1 deletion cmake/projects/Boost/atomic/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
atomic
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/chrono/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
chrono
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/context/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
context
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/coroutine/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
coroutine
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/date_time/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
date_time
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/exception/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
exception
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/filesystem/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
filesystem
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/graph/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
graph
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/graph_parallel/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
graph_parallel
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/hunter.cmake
Expand Up @@ -280,4 +280,4 @@ hunter_add_version(

hunter_pick_scheme(DEFAULT url_sha1_boost)
hunter_cacheable(Boost)
hunter_download(PACKAGE_NAME Boost PACKAGE_INTERNAL_DEPS_ID "18")
hunter_download(PACKAGE_NAME Boost PACKAGE_INTERNAL_DEPS_ID "19")
2 changes: 1 addition & 1 deletion cmake/projects/Boost/hunter.cmake.in
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
boost_component
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/iostreams/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
iostreams
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/locale/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
locale
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/log/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
log
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/math/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
math
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/mpi/hunter.cmake
Expand Up @@ -26,5 +26,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
mpi
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/program_options/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
program_options
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/python/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
python
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/random/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
random
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/regex/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
regex
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
12 changes: 10 additions & 2 deletions cmake/projects/Boost/schemes/url_sha1_boost.cmake.in
Expand Up @@ -17,6 +17,7 @@ include(hunter_status_debug)
include(hunter_status_print)
include(hunter_test_string_not_empty)
include(hunter_user_error)
include(hunter_parse_boost_config_macros)

hunter_status_debug("Scheme: url_sha1_boost")

Expand All @@ -27,6 +28,7 @@ hunter_test_string_not_empty("@HUNTER_PACKAGE_URL@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_SHA1@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_DOWNLOAD_DIR@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_SOURCE_DIR@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_BUILD_DIR@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_INSTALL_PREFIX@")
hunter_test_string_not_empty("@HUNTER_Boost_VERSION@")
hunter_test_string_not_empty("@HUNTER_PACKAGE_LICENSE_DIR@")
Expand Down Expand Up @@ -95,6 +97,13 @@ else()
set(log_opts "")
endif()

hunter_parse_boost_config_macros(BOOST_CONFIG_MACROS "@HUNTER_Boost_CMAKE_ARGS@")
configure_file(
"@HUNTER_GLOBAL_SCRIPT_DIR@/append-boost-config-macros.cmake.in"
"@HUNTER_PACKAGE_BUILD_DIR@/append-boost-config-macros.cmake"
@ONLY
)

ExternalProject_Add(
"@HUNTER_EP_NAME@"
URL
Expand All @@ -110,8 +119,7 @@ ExternalProject_Add(
# not used, just avoid creating Install/<name> empty directory
UPDATE_COMMAND
"@CMAKE_COMMAND@" -P
"@HUNTER_GLOBAL_SCRIPT_DIR@/append-boost-config-macros.cmake"
"@HUNTER_Boost_CMAKE_ARGS@"
"@HUNTER_PACKAGE_BUILD_DIR@/append-boost-config-macros.cmake"
CONFIGURE_COMMAND
${env_cmd}
COMMAND
Expand Down
11 changes: 9 additions & 2 deletions cmake/projects/Boost/schemes/url_sha1_boost_ios_library.cmake.in
Expand Up @@ -18,6 +18,7 @@ include(hunter_status_debug)
include(hunter_test_string_not_empty)
include(hunter_unsetvar)
include(hunter_get_boost_libs)
include(hunter_parse_boost_config_macros)

hunter_status_debug("Scheme: url_sha1_boost_ios_library")

Expand Down Expand Up @@ -296,6 +297,13 @@ else()
set(extra_lib_command "")
endif()

hunter_parse_boost_config_macros(BOOST_CONFIG_MACROS "@HUNTER_Boost_CMAKE_ARGS@")
configure_file(
"@HUNTER_GLOBAL_SCRIPT_DIR@/append-boost-config-macros.cmake.in"
"@HUNTER_PACKAGE_BUILD_DIR@/append-boost-config-macros.cmake"
@ONLY
)

ExternalProject_Add(
"@HUNTER_EP_NAME@-ios_universal"
DEPENDS
Expand All @@ -312,8 +320,7 @@ ExternalProject_Add(
# not used, just avoid creating Install/<name> empty directory
UPDATE_COMMAND
"@CMAKE_COMMAND@" -P
"@HUNTER_GLOBAL_SCRIPT_DIR@/append-boost-config-macros.cmake"
"@HUNTER_Boost_CMAKE_ARGS@"
"@HUNTER_PACKAGE_BUILD_DIR@/append-boost-config-macros.cmake"
CONFIGURE_COMMAND
""
BUILD_COMMAND
Expand Down
11 changes: 9 additions & 2 deletions cmake/projects/Boost/schemes/url_sha1_boost_library.cmake.in
Expand Up @@ -23,6 +23,7 @@ include(hunter_status_debug)
include(hunter_status_print)
include(hunter_test_string_not_empty)
include(hunter_user_error)
include(hunter_parse_boost_config_macros)

hunter_status_debug("Scheme: url_sha1_boost_library")

Expand Down Expand Up @@ -350,6 +351,13 @@ else()
set(log_opts "")
endif()

hunter_parse_boost_config_macros(BOOST_CONFIG_MACROS "@HUNTER_Boost_CMAKE_ARGS@")
configure_file(
"@HUNTER_GLOBAL_SCRIPT_DIR@/append-boost-config-macros.cmake.in"
"@HUNTER_PACKAGE_BUILD_DIR@/append-boost-config-macros.cmake"
@ONLY
)

ExternalProject_Add(
"@HUNTER_EP_NAME@"
URL
Expand All @@ -365,8 +373,7 @@ ExternalProject_Add(
# not used, just avoid creating Install/<name> empty directory
UPDATE_COMMAND
"@CMAKE_COMMAND@" -P
"@HUNTER_GLOBAL_SCRIPT_DIR@/append-boost-config-macros.cmake"
"@HUNTER_Boost_CMAKE_ARGS@"
"@HUNTER_PACKAGE_BUILD_DIR@/append-boost-config-macros.cmake"
CONFIGURE_COMMAND
${env_cmd}
${copy_mpi_command}
Expand Down
2 changes: 1 addition & 1 deletion cmake/projects/Boost/serialization/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
serialization
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/signals/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
signals
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/system/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
system
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/test/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
test
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/thread/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
thread
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/timer/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
timer
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
2 changes: 1 addition & 1 deletion cmake/projects/Boost/wave/hunter.cmake
Expand Up @@ -18,5 +18,5 @@ hunter_download(
Boost
PACKAGE_COMPONENT
wave
PACKAGE_INTERNAL_DEPS_ID "18"
PACKAGE_INTERNAL_DEPS_ID "19"
)
35 changes: 0 additions & 35 deletions scripts/append-boost-config-macros.cmake

This file was deleted.

17 changes: 17 additions & 0 deletions scripts/append-boost-config-macros.cmake.in
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.0)

# run at the boost source root
set(boost_user_config_file "boost/config/user.hpp")

foreach(s @BOOST_CONFIG_MACROS@)
unset(append_str)
if("${s}" MATCHES "^([^=]+)=(.+)" )
set(append_str "#define ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}")
else()
set(append_str "#define ${s}")
endif()
if(append_str)
message("-- append '${append_str}' to '${boost_user_config_file}'")
file(APPEND "${boost_user_config_file}" "\n${append_str}\n")
endif()
endforeach()

0 comments on commit 0a4fc16

Please sign in to comment.