diff options
| author | Matthias Schmieder <schmieder.matthias@gmail.com> | 2018-10-22 18:29:54 +0200 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-10-22 09:29:54 -0700 |
| commit | cba23fe693f0d6b5e1ef50a197b74fdd8804c60a (patch) | |
| tree | 3f459ac8d348e64255eda1c8966f24a14597e7c3 | |
| parent | 13e4ca65872c0f3ad9413a5b937c467708e53e03 (diff) | |
| download | vcpkg-cba23fe693f0d6b5e1ef50a197b74fdd8804c60a.tar.gz vcpkg-cba23fe693f0d6b5e1ef50a197b74fdd8804c60a.zip | |
Fix boost compile & linker flags (#3871)
* making sure there is a leading <compileflags> even if CMAKE_CXX_FLAGS do not start with a whitespace
* making sure there is a leading <compileflags> even if CMAKE_CXX_FLAGS do not start with a whitespace
* full support for CXXFLAGS, CFLAGS and LDFLAGS throughout the boost-modular-build-helper
* [boost-modular-build-helper] Bump version and use CMAKE_* macros since the VCPKG_* macros are not passed in
* [boost-type-erasure] Depend on boost-thread even in UWP
| -rw-r--r-- | ports/boost-modular-build-helper/CMakeLists.txt | 34 | ||||
| -rw-r--r-- | ports/boost-modular-build-helper/CONTROL | 2 | ||||
| -rw-r--r-- | ports/boost-modular-build-helper/boost-modular-build.cmake | 39 | ||||
| -rw-r--r-- | ports/boost-modular-build-helper/user-config.jam | 2 |
4 files changed, 75 insertions, 2 deletions
diff --git a/ports/boost-modular-build-helper/CMakeLists.txt b/ports/boost-modular-build-helper/CMakeLists.txt index dc4d13dd1..df109c57e 100644 --- a/ports/boost-modular-build-helper/CMakeLists.txt +++ b/ports/boost-modular-build-helper/CMakeLists.txt @@ -40,7 +40,39 @@ else() list(APPEND B2_OPTIONS target-os=linux toolset=gcc)
endif()
-string(REPLACE " " " <compileflags>" CXXFLAGS "${CMAKE_CXX_FLAGS}")
+# Properly handle compiler and linker flags passed by VCPKG
+if(CMAKE_BUILD_TYPE STREQUAL "Release")
+ set(CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
+ set(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
+ if(BUILD_SHARED_LIBS)
+ set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
+ else()
+ set(LDFLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${CMAKE_STATIC_LINKER_FLAGS_RELEASE}")
+ endif()
+elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
+ set(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
+ if(BUILD_SHARED_LIBS)
+ set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
+ else()
+ set(LDFLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${CMAKE_STATIC_LINKER_FLAGS_DEBUG}")
+ endif()
+endif()
+
+string(STRIP "${CXXFLAGS}" CXXFLAGS)
+string(STRIP "${CFLAGS}" CFLAGS)
+string(STRIP "${LDFLAGS}" LDFLAGS)
+
+if(NOT CXXFLAGS STREQUAL "")
+ string(REPLACE " " " <cxxflags>" CXXFLAGS "<cxxflags>${CXXFLAGS}")
+endif()
+if(NOT CFLAGS STREQUAL "")
+ string(REPLACE " " " <cflags>" CFLAGS "<cflags>${CFLAGS}")
+endif()
+if(NOT LDLAGS STREQUAL "")
+ string(REPLACE " " " <linkflags>" LDFLAGS "<linkflags>${LDFLAGS}")
+endif()
+
#set(CXXFLAGS "${CXXFLAGS} <compileflags>-Wno-error=unused-command-line-argument")
if(CMAKE_CXX_COMPILER_TARGET)
set(CXXFLAGS "${CXXFLAGS} <compileflags>${CMAKE_CXX_COMPILE_OPTIONS_TARGET} <compileflags>${CMAKE_CXX_COMPILER_TARGET}")
diff --git a/ports/boost-modular-build-helper/CONTROL b/ports/boost-modular-build-helper/CONTROL index 93675e268..a598c741d 100644 --- a/ports/boost-modular-build-helper/CONTROL +++ b/ports/boost-modular-build-helper/CONTROL @@ -1,2 +1,2 @@ Source: boost-modular-build-helper
-Version: 2018-08-21
+Version: 2018-10-19
diff --git a/ports/boost-modular-build-helper/boost-modular-build.cmake b/ports/boost-modular-build-helper/boost-modular-build.cmake index 6e81aa163..2dfb19f6b 100644 --- a/ports/boost-modular-build-helper/boost-modular-build.cmake +++ b/ports/boost-modular-build-helper/boost-modular-build.cmake @@ -164,6 +164,45 @@ function(boost_modular_build) -sBZIP2_LIBPATH="${CURRENT_INSTALLED_DIR}/lib"
)
+ # Properly handle compiler and linker flags passed by VCPKG
+ if(VCPKG_CXX_FLAGS)
+ list(APPEND _bm_OPTIONS cxxflags="${VCPKG_CXX_FLAGS}")
+ endif()
+
+ if(VCPKG_CXX_FLAGS_RELEASE)
+ list(APPEND _bm_OPTIONS_REL cxxflags="${VCPKG_CXX_FLAGS_RELEASE}")
+ endif()
+
+ if(VCPKG_CXX_FLAGS_DEBUG)
+ list(APPEND _bm_OPTIONS_DBG cxxflags="${VCPKG_CXX_FLAGS_DEBUG}")
+ endif()
+
+
+ if(VCPKG_C_FLAGS)
+ list(APPEND _bm_OPTIONS cflags="${VCPKG_C_FLAGS}")
+ endif()
+
+ if(VCPKG_C_FLAGS_RELEASE)
+ list(APPEND _bm_OPTIONS_REL cflags="${VCPKG_C_FLAGS_RELEASE}")
+ endif()
+
+ if(VCPKG_C_FLAGS_DEBUG)
+ list(APPEND _bm_OPTIONS_DBG cflags="${VCPKG_C_FLAGS_DEBUG}")
+ endif()
+
+
+ if(VCPKG_LINKER_FLAGS)
+ list(APPEND _bm_OPTIONS linkflags="${VCPKG_LINKER_FLAGS}")
+ endif()
+
+ if(VCPKG_LINKER_FLAGS_RELEASE)
+ list(APPEND _bm_OPTIONS_REL linkflags="${VCPKG_LINKER_FLAGS_RELEASE}")
+ endif()
+
+ if(VCPKG_LINKER_FLAGS_DEBUG)
+ list(APPEND _bm_OPTIONS_DBG linkflags="${VCPKG_LINKER_FLAGS_DEBUG}")
+ endif()
+
# Add build type specific options
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
diff --git a/ports/boost-modular-build-helper/user-config.jam b/ports/boost-modular-build-helper/user-config.jam index abefc7fae..78677c0ab 100644 --- a/ports/boost-modular-build-helper/user-config.jam +++ b/ports/boost-modular-build-helper/user-config.jam @@ -14,6 +14,8 @@ else <ranlib>@CMAKE_RANLIB@
<archiver>@CMAKE_AR@
@CXXFLAGS@
+ @CFLAGS@
+ @LDFLAGS@
# MINGW here causes b2 to not run cygpath
<flavor>mingw
;
|
