Skip to content

Commit cff8a62

Browse files
author
Hugo Lindström
committed
installer: suffixed lib paths
1 parent 3093193 commit cff8a62

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

cmake/BoostLibInstaller.cmake

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,30 @@ function(boost_lib_installer req_boost_version req_boost_libs)
105105
set(debug_lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-${compiler_name}-mt-gd-${lib_postfix}.lib")
106106
set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-${compiler_name}-mt-${lib_postfix}.lib")
107107
else()
108+
set(LIBSUFFIX "")
109+
if(UNIX)
110+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
111+
set(LIBSUFFIX "-x64")
112+
endif()
113+
endif()
114+
115+
if(APPLE)
116+
# Extract first letter after architecture= (e.g., 'a' from 'architecture=arm')
117+
string(REGEX MATCH "architecture=([a-zA-Z])" _ "${b2Args}")
118+
set(ARCHITECTURE_PREFIX "${CMAKE_MATCH_1}")
119+
120+
# Extract address model number (e.g., 32_64 from address-model=32_64)
121+
string(REGEX MATCH "address-model=([0-9_]+)" _ "${b2Args}")
122+
set(ADDRESS_MODEL "${CMAKE_MATCH_1}")
123+
124+
# Build lib suffix like -x64 or -a32
125+
set(LIBSUFFIX "-${ARCHITECTURE_PREFIX}${ADDRESS_MODEL}")
126+
endif()
127+
108128
if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "") OR (NOT DEFINED CMAKE_BUILD_TYPE))
109-
set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt-d.a")
129+
set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt-d${LIBSUFFIX}.a")
110130
else()
111-
set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt.a")
131+
set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt${LIBSUFFIX}.a")
112132
endif()
113133
endif()
114134

0 commit comments

Comments
 (0)