Hi Brad, thanks for your quick reply. Are you sure it actually worked? There should be three messages showing the 'java' link flags in the cmake output. Here is what I get: --- [EMAIL PROTECTED]:[xgen-3.5.0]> cd build/Linux [EMAIL PROTECTED]:[Linux]> cmake ../.. -- Check for working C compiler: gcc -- Check for working C compiler: gcc -- works -- Check size of void* -- Check size of void* - done -- Check for working CXX compiler: c++ -- Check for working CXX compiler: c++ -- works -- Found flex: /usr/local/bin/flex -- Found bison: /usr/bin/bison -- Found bash shell: /usr/local/bin/bash -- Found sed: /usr/bin/sed -- Found tcl to char* script: /lhome/mhufer/xgen-3.5.0/cmake/create_tcl_startup_code.sh adding external ace to module cssql adding external expat to module cssql adding external gmp to module cssql adding external pcre to module cssql adding external sqlapi to module cssql adding external tcl to module cssql module : linker flags '' adding external ace to module javavm adding external expat to module javavm adding external gmp to module javavm adding external pcre to module javavm adding external sqlapi to module javavm adding external tcl to module javavm adding external java to module javavm java: link flags = '-L/lhome/mhufer/xgen-3.5.0/external/Linux/j2sdk1.4.2_03/jre/lib/i386' module : linker flags ' -L/lhome/mhufer/xgen-3.5.0/external/Linux/j2sdk1.4.2_03/jre/lib/i386' -- Configuring done -- Generating done -- Build files have been written to: /lhome/mhufer/xgen-3.5.0/build/Linux [EMAIL PROTECTED]:[Linux]> --- I.e. the third message ( '[...] adding the linker flags [...]' ) from the macro code: --- [...] if( DEFINED ${EXT_LINK_FLAGS} ) message( "module ${EXT}: adding the linker flags '${EXT_LINK_FLAGS}'" ) set_target_properties( ${MODULE} PROPERTIES LINK_FLAGS "${EXT_LINK_FLAGS}" ) endif( DEFINED ${EXT_LINK_FLAGS} ) [...] --- which is only written if the EXT_LINK_FLAGS variable is defined is missing.
Oh... I forgot I'm (of course) using the current 2.4.3 version of CMake. Cheers, Micha. > > Michael Hufer wrote: > > Hi all, > > I am new to CMake and am currently switching the make system for our > > X-Gen product to CMake. > > Since the project contains a lot of shared libraries I wrote a macro to > > ease the writing of CMakeLists.txt for them. The macro receives a list of > > "external" libraries this library depends on. Some of these externals > > require extra defines or link flags and I collect them in the macro like > > this: --- > > foreach( EXT ${EXTERNAL_LIBS} ) > > [...] > > if( DEFINED ${EXT}_DEFINES ) > > set( EXT_DEFINES "${EXT_DEFINES} ${${EXT}_DEFINES}" ) > > endif( DEFINED ${EXT}_DEFINES ) > > [...] > > endforeach( EXT ${EXTERNAL_LIBS} ) > > [...] > > if( DEFINED EXT_DEFINES ) > > set_source_files_properties( $MODULE_SOURCES} PROPERTIES COMPILE_FLAGS > > ${EXT_DEFINES} ) > > endif( DEFINED EXT_DEFINES ) > > --- > > (the macro is defined in cmake/XGen-Macros.cmake in the attached > > zip-file). while the first 'if(defined ${EXT}_DEFINES)' works as > > expected the second 'if( DEFINED EXT_DEFINES )' where I check if actually > > any of the 'externals' for this library needs extra defines is always > > false even if the message() inserted before reports that this variable is > > in fact defined and shows its value. > > The handling of extra link flags is identical and there also the first > > 'if-defined' works as expected but the second does not... > > > > I checked and double checked the macrocode, inserted debug messages etc. > > and don't see any obvious errors. > > So what am I doing wrong or did I actually find a bug in cmake? > > I tried your example but had to strip a bunch of code since the source > files are not actually in the zip file. I get the behavior you expect > from IF(DEFINED) in both cases. > > -Brad -- Michael Hufer | EMail: mailto:[EMAIL PROTECTED] Software Developer | WWW: http://www.swissrisk.com SWISSRISK AG | Phone: ++49 69 50952 - 0 _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake