pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.07k stars 2.11k forks source link

Make LIBRARY_OUTPUT_DIRECTORY a cache entry (editable) #4432

Open danny-mhlv opened 5 months ago

danny-mhlv commented 5 months ago

Is your feature request related to a problem? Please describe. While using POCO in my project I've encountered a problem specifying output directory for POCO's .so files. It's unable to change it the standard CMake way, see below.

Describe the solution you'd like I think it's quite convenient to set CMAKE_LIBRARY_OUTPUT_DIRECTORY as CACHE.

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "...")

Describe alternatives you've considered As I am aware there are no alternatives, but to change CMAKE_LIBRARY_OUTPUT_DIRECTORY to be set as CACHE.

aleks-f commented 5 months ago

@danny-mhlv please send a pull request

andrewauclair commented 2 months ago

I think there's still an issue with this related to multi-configs because of the below code in the root CMakeLists.txt. I'm going to give it a look later today.

# Reset output dirs for multi-config builds
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
    string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
endforeach(OUTPUTCONFIG)