[libcxx-dev] cmake caches w/additional compile+link flags

Brian Cain via libcxx-dev libcxx-dev at lists.llvm.org
Tue Aug 18 08:10:59 PDT 2020

In an internal project, we build libcxx+libcxxabi with many settings configured in a cmake cache file.  It gets invoked roughly like so:

cmake -DLLVM_ENABLE_PROJECTS=libcxx;libcxxabi;pstl -C./libcxx/xyz/target.cmake -DCMAKE_INSTALL_PREFIX=/target/install/path ../llvm-project/llvm

... I would prefer to include as many of the relevant build settings as possible in the 'target.cmake' file.  Today we clobber "CMAKE_CXX_FLAGS" with the required target-specific flags in that file and it's effective.  But it doesn't cooperate well with the rest of the libcxx/libcxxabi cmake configuration.

This seems really simple but I've never quite been able to figure out how to append flags to the build configuration from the cmake cache.  I've tried a few different ways of writing to LIBCXX_COMPILE_FLAGS (including with CACHE FORCE) but even if the value in LIBCXX_COMPILE_FLAGS persists in the CMakeCache.txt they don't seem to be reflected in the flags used to build.  So it's probably some cmake rules I don't quite understand about the order or scope in which LIBCXX_COMPILE_FLAGS is defined.

I'm sure I'm missing something simple - can anyone share a good way to accomplish my goal of adding/removing compile+link flags in the preloaded cmake cache file?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20200818/54d04b34/attachment.html>

More information about the libcxx-dev mailing list