Is changing global compiler/linker flags for all executables an option?<br><br>When you enable &quot;show advanced options&quot; in CMake, you should see them as CMAKE_EXE_LINKER_FLAGS_&lt;CONFIG&gt;.<br><br>Also, if you want to set them initially by your build system, use<br>
<br>set(CMAKE_USER_MAKE_RULES_OVERRIDE MyInitialFlags)<br><br>This &quot;MyInitialFlags.cmake&quot; is processed after compiler is determined and you can modify flags. But note, that they have &quot;_INIT&quot; suffix. For example,<br>
<br>if(WIN32)<br>    set(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT &quot;${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} /SUBSYSTEM:WINDOWS&quot;)<br>endif()<br><br>Later the cache will be populated from these _INIT variables (when you call project() or enable_language() command).<br>
<br><div class="gmail_quote">On Thu, Feb 24, 2011 at 11:34 PM, Hanna Symanska <span dir="ltr">&lt;<a href="mailto:hsymanska@gmail.com">hsymanska@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hey,<br>
I have a fairly large project with multiple executables, about 90 to<br>
be exact and I would like to set the subsystem based on the<br>
LINK_FLAGS_* property.<br>
Is there a way for me to globally set this up in a top level<br>
CMakeLists.txt file so that i do not have to place the below code in<br>
every single project.<br>
add_executable(project_n ....)<br>
IF (WIN32)<br>
  SET_TARGET_PROPERTIES(project_n PROPERTIES LINK_FLAGS_RELEASE<br>
&quot;/INCREMENTAL:NO /NODEFAULTLIB:LIBCMT.lib /SUBSYSTEM:WINDOWS&quot; )<br>
  SET_TARGET_PROPERTIES(project_n PROPERTIES LINK_FLAGS_RELWITHDEBINFO<br>
&quot;/NODEFAULTLIB:LIBCMT.lib /SUBSYSTEM:WINDOWS&quot; )<br>
  SET_TARGET_PROPERTIES(project_n PROPERTIES LINK_FLAGS_DEBUG<br>
&quot;/NODEFAULTLIB:LIBCMTD.lib /SUBSYSTEM:CONSOLE&quot; )<br>
ENDIF (WIN32)<br>
<br>
As it stands right now I have a top level CMakeLists.txt file with<br>
several other CMakeLists.txt files in subsequent directories.<br>
I have 1 CMakeLists.txt per project executable. I am trying to avoid<br>
putting the above code in EVERY CMakeLists.txt file, when the only<br>
thing I am changing is the target to reflect the the project that I am<br>
setting the properties on.<br>
I am using CMake 2.8.4 to generate visual studio 2008 project files to<br>
be compiled 64-bit.<br>
I do not want to use set_executable(project_n WIN32...) because I want<br>
the subsystem to be console for projects that are being compiled as<br>
debug.<br>
- Hanna<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>