<div>hi,</div>
<div>here is a small example (hello World example).</div>
<div>i have 2 subdirs Hello (shared lib) and Demo (calling Hello functions)</div>
<div> </div>
<div>in Demo we have</div>
<div> </div>
<div><em><strong>cmake_minimum_required(VERSION 2.6)</strong></em></div>
<div><em><strong># Make sure the compiler can find include files from our Hello library. les fichiers ou se trouvent le code, donc ou se trouve les cmakelists<br>include_directories (${ORIGIN}/Hello)</strong></em></div>
<div><em><strong># Make sure the linker can find the Hello library once it is built. le dossier ou va etre placé lensemble des resultats de la fabriction du projet<br>link_directories (${HELLO_BINARY_DIR}/Hello)</strong></em></div>
<div><em><strong># Add executable called "helloDemo" that is built from the source files<br># "demo.cxx" and "demo_b.cxx". The extensions are automatically found.<br>add_executable (helloDemo ${ORIGIN}/Demo/demo.cxx ${ORIGIN}/Demo/demo_b.cxx )</strong></em></div>
<div><br><em><strong># Link the executable to the Hello library.<br>target_link_libraries (helloDemo Hello)</strong></em></div>
<div><em><strong></strong></em> </div>
<div><br><em><strong>if(MSVC_VERSION)<br> #flags dans le cas release <br> IF(CMAKE_BUILD_TYPE MATCHES Release|Win32)<br> set_target_properties(helloDemo PROPERTIES<br> LINK_FLAGS "/SUBSYSTEM:CONSOLE /MACHINE:X86 /MANIFEST /NOLOGO /DEBUG /mktyplib203"<br>
COMPILE_FLAGS "/GF /Od /W3 /Z7 /Od /MTd /NOLOGO" <br> )<br> #Endif(CMAKE_BUILD_TYPE MATCHES Release|Win32)<br> <br> #flags dans le cas debug<br> elseIF(CMAKE_BUILD_TYPE MATCHES Debug|Win32)<br> set_target_properties(helloDemo PROPERTIES<br>
LINK_FLAGS "/SUBSYSTEM:CONSOLE /INCREMENTAL:NO /MACHINE:X86 /MANIFEST /NOLOGO /DEBUG /mktyplib203"<br> COMPILE_FLAGS "/GF /Od /W3 /Z7 /Od /MTd" <br> )<br> #ENDIF(CMAKE_BUILD_TYPE MATCHES Debug|Win32)<br>
Endif(CMAKE_BUILD_TYPE MATCHES Release|Win32) #attention rajouté</strong></em></div>
<div><em><strong>endif(MSVC_VERSION)</strong></em></div>
<div> </div>
<div>and there is no problem, all the flags are set.</div>
<div> </div>
<div>In Hello, i want different flags in Debug and Release and i have </div>
<div> </div>
<div><em><strong>add_library (Hello SHARED ${ORIGIN}/Hello/hello.cxx ${ORIGIN}/Hello/hello.h)</strong></em></div>
<div><em><strong>message(status :" on est passé de add lib")<br>#set(DEBUG_OUTPUT_NAME "ingridd_so") # ne marche pas à l'exterieur<br>set(VARIAB "DEBUG")</strong></em></div>
<div><em><strong>#set(CMAKE_CONFIGURATION_TYPES [Debug, Release]) #a tester pr voir si restreint les types a ces deux la</strong></em></div>
<div><em><strong>message (status : "la valeur de la connerie la que je ne connais pas est : ${CMAKE_INTDIR}")</strong></em></div>
<div><em><strong>if(MSVC_VERSION)<br> message(status " : on traaite le cas de visual studio!!!!!!!!!!!!!!!!! pur un debut")<br> <br> IF (${CMAKE_CFG_INTDIR} MATCHES "Debug")<br> #ATTENTION : DO NOT USE BOTH SET_TARGET_PROP AND ADD_DEFINITIONS<br>
set_target_properties(Hello PROPERTIES<br> <br> #COMPILE OPTIONS IN DEBUG AND RELEASE<br> #CMAKE_CXX_FLAGS_RELEASE "/Gz /GF /Gy /Od /W3 /ZI /Od /MTd"<br> #CMAKE_CXX_FLAGS_DEBUG "/Od /MDd /W3 /nologo /Z7 /Gz /TC"<br>
<br> COMPILE_FLAGS "/Od /MDd /W3 /nologo /Z7 /Gz /TC"<br><br> #LINK OPTIONS IN DEBUG AND RELEASE<br> LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE /INCREMENTAL:NO /MACHINE:X86 /MANIFEST /NOLOGO /DEBUG"<br>
</strong></em></div>
<div><em><strong> LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE /INCREMENTAL:NO /MACHINE:X86 /MANIFEST /NOLOGO /DEBUG "<br> #COMPILE_FLAGS_RELEASE "/GF /Od /W3 /Z7 /Od /MTd" #DO NOT WORK<br><br> )<br>
else (${CMAKE_CFG_INTDIR} MATCHES "Debug")<br> set_target_properties(Hello PROPERTIES<br> <br> #COMPILE OPTIONS IN DEBUG AND RELEASE<br> #CMAKE_CXX_FLAGS_RELEASE "/Gz /GF /Gy /Od /W3 /ZI /Od /MTd"<br>
#CMAKE_CXX_FLAGS_DEBUG "/Od /MDd /W3 /nologo /Z7 /Gz /TC"<br> <br> COMPILE_FLAGS "/O2 /MDd /W3 /nologo /Z7 /Gz /TC"<br><br> LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE /INCREMENTAL:NO /MACHINE:X86 /MANIFEST /NOLOGO /DEBUG"<br>
LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE /INCREMENTAL:NO /MACHINE:X86 /MANIFEST /NOLOGO /DEBUG "<br> #COMPILE_FLAGS_RELEASE "/GF /Od /W3 /Z7 /Od /MTd" #DO NOT WORK<br> ENABLE_EXPORTS "true"<br>
)<br> endif(${CMAKE_CFG_INTDIR} MATCHES "Debug")<br>endif(MSVC_VERSION)<br></strong></em></div>
<div> </div>
<div> </div>
<div>when using compile_flags, everything goes well (i have al the flags i've asked for)</div>
<div>but with CMAKE_CXX_FLAGS_DEBUG i have nothing (just default MSVC flags).</div>
<div> </div>
<div>Thanks.</div>
<div> </div>
<div> </div>
<div><br> </div>
<div class="gmail_quote">2008/6/18 Bill Hoffman <<a href="mailto:bill.hoffman@kitware.com">bill.hoffman@kitware.com</a>>:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="Wj3C7c">Eric Noulard wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">2008/6/18 Ingrid Kemgoum <<a href="mailto:ingrid.kemgoum@gmail.com" target="_blank">ingrid.kemgoum@gmail.com</a>>:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">yes i do have read that.<br>it's why i've tried CMAKE_CXX_FLAGS_<config>. (<config> for DEBUG and<br>
RELEASE).<br>but that have no effect on MSVC flags.<br>(on Unix after fixing the build type first, the CMAKE_CXX_FLAGS_<config><br>works but not on windows!)<br></blockquote><br>Ok then it may be a MSVC specific pb.<br>
I'm afraid I won't be able to help for that config :=(<br><br></blockquote></div></div>These options certainly do affect MSVC. I suspect that your project is doing something funny. Please post a "small" example that shows the flags are not being used.<br>
<font color="#888888"><br>-Bill<br></font></blockquote></div><br>