mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 14:58:00 +08:00
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
This commit is contained in:
parent
13e4ca6587
commit
cba23fe693
@ -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}")
|
||||
|
@ -1,2 +1,2 @@
|
||||
Source: boost-modular-build-helper
|
||||
Version: 2018-08-21
|
||||
Version: 2018-10-19
|
||||
|
@ -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")
|
||||
|
@ -14,6 +14,8 @@ else
|
||||
<ranlib>@CMAKE_RANLIB@
|
||||
<archiver>@CMAKE_AR@
|
||||
@CXXFLAGS@
|
||||
@CFLAGS@
|
||||
@LDFLAGS@
|
||||
# MINGW here causes b2 to not run cygpath
|
||||
<flavor>mingw
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user