boostorg / boostorg/process

CMake build doesn't disable the Windows autolink feature

Open
#525 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Description

When using the CMake build for the process component of Boost on Windows, the autolink feature is still active (using process v2 API), resulting in a link error:

`LINK : fatal error LNK1104: cannot open file 'boost_process-vc143-mt-gd-x64-1_89.lib'`

Using boost 1.89 release but I believe the problem is still present currently, i.e. autolink is active for CMake builds.

When comparing the CMakeLists.txt of Boost process with e.g. filesystem or url we don't have a BOOST_<COMPONENT>_NO_LIB define in Boost process:

url:
--8<--
function(boost_url_setup_properties target)
target_compile_features(${target} PUBLIC cxx_constexpr)
target_compile_definitions(${target} PUBLIC BOOST_URL_NO_LIB=1)
--8<--

filesystem:
--8<--
target_compile_definitions(boost_filesystem
PUBLIC
# NOTE:
# We deactivate autolinking, because cmake based builds don't need it
# and we don't implement name mangling for the library file anyway.
# Ususally the parent CMakeLists.txt file should already have globally defined BOOST_ALL_NO_LIB
BOOST_FILESYSTEM_NO_LIB
$<$<STREQUAL:$<TARGET_PROPERTY:boost_filesystem,TYPE>,SHARED_LIBRARY>:BOOST_FILESYSTEM_DYN_LINK=1>
$<$<STREQUAL:$<TARGET_PROPERTY:boost_filesystem,TYPE>,STATIC_LIBRARY>:BOOST_FILESYSTEM_STATIC_LINK=1>
PRIVATE
BOOST_FILESYSTEM_SOURCE
)
--8<--

Changing in process' CMakeLists.txt from...

--8<--
target_compile_definitions(boost_process
PRIVATE BOOST_PROCESS_SOURCE=1
)
--8<--
to...
--8<--
target_compile_definitions(boost_process
PUBLIC BOOST_PROCESS_NO_LIB
PRIVATE BOOST_PROCESS_SOURCE=1
)
--8<--

...solves the problem as it disables the autolink features.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.