<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 18, 2020, at 11:10, Brian Cain via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" class="">libcxx-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">In an internal project, we build libcxx+libcxxabi with many settings configured in a cmake cache file.  It gets invoked roughly like so:<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif; text-indent: 0.5in;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif; text-indent: 0.5in;" class="">cmake -DLLVM_ENABLE_PROJECTS=libcxx;libcxxabi;pstl -C./libcxx/xyz/target.cmake -DCMAKE_INSTALL_PREFIX=/target/install/path ../llvm-project/llvm<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">… 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. <span class="Apple-converted-space"> </span><o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">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. <o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">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?<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div></div></blockquote><br class=""></div><div>I'm not sure there's a way to do that -- the question I'd have is what flags are you trying to set? At first sight, it looks to me like you're trying to use CMake the wrong way, and that's why it gets in your way :-). There might be another way of achieving what you're trying to do.</div><div><br class=""></div><div>Louis</div><div><br class=""></div></body></html>