[CMake] Conditional dependency
Hi, I have a project which is build a library fine with CMake (has around 100 source file). ADD_LIBRARY ( mylib STATIC a.cpp b.cpp c.cpp etc ) The content in b.cpp is relevant to only some platform platform. How do I tell CMake that file b.cpp is only to be include as depends of library mylib only if a platform string match. I can achieve the desired effect with IF (WIN32) ADD_LIBRARY ( mylib STATIC a.cpp c.cpp etc) ELSE (WIN32) ADD_LIBRARY ( mylib STATIC a.cpp b.cpp c.cpp etc) ENDIF (WIN32) As there are hundreds of file, I want to avoid duplicating and add to maintainence. Regards ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] can't pipe cl.exe in a custom command
Brandon Van Every wrote: I'm trying to grab the cl.exe banner so I can determine the MSVC version number. If cl.exe is in the path, then the following works at a Windows Command Prompt. This gives a short banner with the VC version number and copyright. cl /? 2 banner.txt But when I try to do it in a custom command, I can't get it to pipe to a file. I see the output go by in the Visual Studio output window, with 1 prefixed in front of all the lines, and it is saved in BuildLog.htm, but cbanner.txt has 0 length no matter whether I use 1 2 as the pipe. Does MSVC simply not have a notion of piping or something? Do I have to do something MSVC-specific to capture the output or the error? IF(MSVC) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_BINARY_DIR}/cbanner.txt WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ${CMAKE_C_COMPILER} /? 2 cbanner.txt ) ADD_CUSTOM_TARGET(cbanner ALL DEPENDS ${CMAKE_BINARY_DIR}/cbanner.txt ) ENDIF(MSVC) This is a feature in Visual Studio 8, which drove me nuts before I realized what was going on. The short story is that cl sends its output via a backchannel (a pipe, presumable) to the output window when run from inside Visual Studio, so redirection does not work (there is nothing to redirect). To get around this, you need to clear the environment variable VS_UNICODE_OUTPUT before invoking cl.exe. The longer story (with some useful links): http://thisisnotaprogrammersblog.blogspot.com/2007/05/redirecting-output-from-compilerlinker.html -- /Jesper ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Conditional dependency
On 11/6/07, Nicholas Yue [EMAIL PROTECTED] wrote: Hi, I have a project which is build a library fine with CMake (has around 100 source file). ADD_LIBRARY ( mylib STATIC a.cpp b.cpp c.cpp etc ) The content in b.cpp is relevant to only some platform platform. How do I tell CMake that file b.cpp is only to be include as depends of library mylib only if a platform string match. I can achieve the desired effect with IF (WIN32) ADD_LIBRARY ( mylib STATIC a.cpp c.cpp etc) ELSE (WIN32) ADD_LIBRARY ( mylib STATIC a.cpp b.cpp c.cpp etc) ENDIF (WIN32) As there are hundreds of file, I want to avoid duplicating and add to maintainence. Try this: IF(NOT WIN32) SET(b_SOUCE b.cpp) ENDIF(NOT WIN32) ADD_LIBRARY ( myLib STATIC a.cpp ${b_SOURCE} c.cpp etc ) If you're not on WIN32, then the variable ${b_SOURCE} will be empty. -- Salvatore Iovene http://www.iovene.com/ Key Fingerprint: 5647 944D D5AD 2E87 00B4 7D54 2864 359D FF20 16D8 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Re: Getting started with CMake macros
Please ignore the previous post! I found the solution myself. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Getting started with CMake macros
Is there a beginners guide to macros somewhere? I tried something basic like wrapping up find_library like this: macro(my_find_library arg1 arg2) find_library(arg1 arg2) endmacro(my_find_library) my_find_library(CPPUNIT cppunit) To my surprise it didn't work at all. If I browse CMakeCache.txt there is no reference to CPPUNIT. If I call find_library directly it works! Regards, Thomas ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Conditional dependency
2007/11/6, Salvatore Iovene [EMAIL PROTECTED]: On 11/6/07, Nicholas Yue [EMAIL PROTECTED] wrote: As there are hundreds of file, I want to avoid duplicating and add to maintainence. Try this: IF(NOT WIN32) SET(b_SOUCE b.cpp) ENDIF(NOT WIN32) ADD_LIBRARY ( myLib STATIC a.cpp ${b_SOURCE} c.cpp etc ) If you're not on WIN32, then the variable ${b_SOURCE} will be empty. In the same spirit I usually define a var which contains the list of file to be included in a library and augment var content conditionally. The general pattern is the following: # put unconditional sources in SET(MYLIB_SRC c.cpp g.cpp any otherunconditional source) # then ADD the conditional ones IF(WIN32) SET(MYLIB_SRC ${MYLIB_SRC} win32-a.cpp) ENDIF(WIN32) IF(LIBXML2_FOUND) SET(MYLIB_SRC ${MYLIB_SRC} xml2-a.cpp) ENDIF() [... etc ...] # now define the lib ADD_LIBRARY(myLib STATIC ${MYLIB_SRC}) -- Erk ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Getting started with CMake macros
2007/11/6, Thomas Sondergaard [EMAIL PROTECTED]: Is there a beginners guide to macros somewhere? I tried something basic like wrapping up find_library like this: macro(my_find_library arg1 arg2) find_library(arg1 arg2) endmacro(my_find_library) my_find_library(CPPUNIT cppunit) To my surprise it didn't work at all. If I browse CMakeCache.txt there is no reference to CPPUNIT. If I call find_library directly it works! You need to use the value (${arg1} ${arg2}) of the arguments and not the arg name itself. Try this: macro(my_find_library arg1 arg2) message(arg1) message(arg2) message(arg1 = ${arg1}) message(arg2 = ${arg2}) endmacro(my_find_library) my_find_library(TOTO titi) If you need more example of MACRO usage you look at CMake distros modules directory. For example: CheckTypeSize.cmake CheckFunctionExists.cmake or any other containing MACRO. -- Erk ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Link directories order
Hi all, I posted an issue about link dir order a week ago, but it seems nobody has replied to it :-/ Is there a reason like one should not use env var, but FindXXX scripts instead, or did it simply slip through unnoticed? The initial post follows. Thanks, Renaud. Hello, I'm having trouble with cmake LINK_DIRECTORIES order. I understand cmake smart-orders link directory flags. However, flags coming from the shell env LDFLAGS don't seem to be taken into account in this smart sort. Is this a feature or a bug? To illustrate the issue, I slightly modified the example code from http://www.cmake.org/HTML/cmakeExample.tar.gz The only change is in cmakeExample.tar.gz:CMakeExample/Hello/CMakeLists.txt which becomes # Create a library called Hello which includes the source file hello.cxx. # The extension is already found. Any number of sources could be listed here. add_library (Hello hello.cxx) INSTALL(TARGETS Hello RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) As one can see in the attached terminal output, the linker for Demo looks in /tmp/lib before looking in the build dir: /usr/bin/c++ -headerpad_max_install_names -fPIC -L/tmp/lib CMakeFiles/helloDemo.dir/demo.o CMakeFiles/helloDemo.dir/demo_b.o -o helloDemo -L/Volumes/Data/Users/detryr/tmp/CMakeExample/Hello -lHello As a result, Demo is linked against an obsolete installed version of Hello, instead of the local fresh one. Here's the terminal output (note that /tmp/lib was empty when I ran cmake): [EMAIL PROTECTED] $ export LDFLAGS=-L/tmp/lib [~/tmp/ CMakeExample] [EMAIL PROTECTED] $ rm /tmp/lib/libHello.a [~/tmp/ CMakeExample] rm: /tmp/lib/libHello.a: No such file or directory [EMAIL PROTECTED] $ cmake -DCMAKE_INSTALL_PREFIX=/tmp [~/tmp/ CMakeExample] [...] [EMAIL PROTECTED] $ make VERBOSE=1 [~/tmp/ CMakeExample] [...] cd /Volumes/Data/Users/detryr/tmp/CMakeExample/Demo /usr/bin/c+ + -headerpad_max_install_names -fPIC -L/tmp/lib CMakeFiles/ helloDemo.dir/demo.o CMakeFiles/helloDemo.dir/demo_b.o -o helloDemo -L/Volumes/Data/Users/detryr/tmp/CMakeExample/Hello -lHello [...] ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Conditional dependency
Zitat von Eric Noulard [EMAIL PROTECTED]: 2007/11/6, Salvatore Iovene [EMAIL PROTECTED]: On 11/6/07, Nicholas Yue [EMAIL PROTECTED] wrote: As there are hundreds of file, I want to avoid duplicating and add to maintainence. Try this: IF(NOT WIN32) SET(b_SOUCE b.cpp) ENDIF(NOT WIN32) ADD_LIBRARY ( myLib STATIC a.cpp ${b_SOURCE} c.cpp etc ) If you're not on WIN32, then the variable ${b_SOURCE} will be empty. In the same spirit I usually define a var which contains the list of file to be included in a library and augment var content conditionally. The general pattern is the following: # put unconditional sources in SET(MYLIB_SRC c.cpp g.cpp any otherunconditional source) # then ADD the conditional ones IF(WIN32) SET(MYLIB_SRC ${MYLIB_SRC} win32-a.cpp) ENDIF(WIN32) IF(LIBXML2_FOUND) SET(MYLIB_SRC ${MYLIB_SRC} xml2-a.cpp) ENDIF() Additionally, I suggest using the LIST macro instead, the above actually reinvents LIST(APPEND ). HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link directories order
Zitat von Renaud Detry [EMAIL PROTECTED]: I posted an issue about link dir order a week ago, but it seems nobody has replied to it :-/ Is there a reason like one should not use env var, but FindXXX scripts instead, or did it simply slip through unnoticed? Did you try to give the whole path to the lib instead of seperate library name and path? And since you build the lib yourself with a cmake TARGET, the TARGET name should be used as link dependency. OTOH: why do you shoot yourself in the foot and define linker flags that do not express what you actually want? HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Re: Qt version of Cmake
Well, there is a weekend of my life I'll never get back ;-) ... I'll take a look and get back to you. I have been learning a bunch about Qt (relearning actually) so maybe we can not stumble over each other... Cheers -- Mike Jackson Senior Research Engineer Innovative Management Technology Services On Nov 5, 2007, at 11:35 PM, [EMAIL PROTECTED] wrote: My implementation is already going into the CMake repository, and it seems I'm a bit further than you. You can try mine out, give feedback, patches, comments, whatever... Clint Message: 6 Date: Mon, 5 Nov 2007 22:08:28 -0500 From: Mike Jackson [EMAIL PROTECTED] Subject: Re: [CMake] Qt version of Cmake To: Bill Hoffman [EMAIL PROTECTED], Cmake Mailing List cmake@cmake.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed I am moving along on my Qt Implementation of CMakeSetup. I have project loading, parsing of the Cache file, toggling of Advanced Values, real time filtering of the cache table all generally working. I started this evening on actually invoking the configure button. Looks like I am not picking up the environment I guess: Here is some sample output: [updateProgress] -1The C compiler identification is GNU [updateProgress] -1The CXX compiler identification is GNU [updateProgress] -1Check for working C compiler: /usr/bin/gcc [updateProgress] -1Check for working C compiler: /usr/bin/gcc -- works [updateProgress] -1Check size of void* [updateProgress] -1Check size of void* - done [updateProgress] -1Check for working CXX compiler: /usr/bin/c++ [updateProgress] -1Check for working CXX compiler: /usr/bin/c++ -- works [CMMessageCallback] CMake Error: Please install the Boost libraries AND development packages [updateProgress] 1Configuring [updateProgress] -1Configuring done [CMMessageCallback] CMake Error: Error in configuration process, project files may be invalid If I run the same project using cmake from the command line this project will build just fine. I am not real familiar about loading environment variables into a program (never needed to) so I am not sure what to do at this point. Any help would be appreciated. Side Note: I am pretty much using as much of the MFC code as possible, where appropriate. The current code state is ugly but functional. I will release it all under a BSD license when I get something working a bit better than where it currently is. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Qt version of Cmake
I was confused about function callbacks instead of C++ abstract classes but then I remember that not all of cmake is probably c++ (ncurses I would guess). Would still be a cleaner OOP to use abstract classes for the error/message callbacks. -- Mike Jackson Senior Research Engineer Innovative Management Technology Services On Nov 6, 2007, at 1:40 AM, Manuel Klimek wrote:I was Funny, for a lng time nothing happens, and now three people are working on one :-) I'm, too, mainly to learn how to TDD a GUI, so I have a different goal, perhaps I'll just go on to see how a TDD program differs from a traditionally coded one, see http://sourceforge.net/projects/qcmake if you're interested. I'm not using any code of the other implementations. The first thing I stumbled upon on during my tests was a global variable for errors. I would really be interested on why it is used... historical reasons, or a real benefit? Cheers, Manuel On Nov 6, 2007 5:02 AM, Bill Hoffman [EMAIL PROTECTED] wrote: ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] can't pipe cl.exe in a custom command
Hi, I'm trying to grab the cl.exe banner so I can determine the MSVC version number. If cl.exe is in the path, then the following works at a Windows Command Prompt. This gives a short banner with the VC version number and copyright. cl /? 2 banner.txt But when I try to do it in a custom command, I can't get it to pipe to a file. I see the output go by in the Visual Studio output window, with 1 prefixed in front of all the lines, and it is saved in BuildLog.htm, but cbanner.txt has 0 length no matter whether I use 1 2 as the pipe. Does MSVC simply not have a notion of piping or something? Do I have to do something MSVC-specific to capture the output or the error? IF(MSVC) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_BINARY_DIR}/cbanner.txt WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ${CMAKE_C_COMPILER} /? 2 cbanner.txt ) ADD_CUSTOM_TARGET(cbanner ALL DEPENDS ${CMAKE_BINARY_DIR}/cbanner.txt ) ENDIF(MSVC) Had a similar problem during generating a file with or with . Then I used VERBATIM and it worked. Maybe this will help here too. Greetings Alexander Please note: This e-mail may contain confidential information intended solely for the addressee. If you have received this e-mail in error, please do not disclose it to anyone, notify the sender promptly, and delete the message from your system. Thank you. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link directories order
Did you try to give the whole path to the lib instead of seperate library name and path? Can that be done without writing the lib suffix explicitly (not cross- platform)? And since you build the lib yourself with a cmake TARGET, the TARGET name should be used as link dependency. I don't see what you mean, could you make this explicit please? Does this have something to do with the INSTALL statement? If not, it is the online example that should be changed. OTOH: why do you shoot yourself in the foot and define linker flags that do not express what you actually want? I defined linker flags that express what I want. I have software installed in non-standard directories like /sw/lib and /usr/local/lib, and I do want CMake to look there (cf. LDFLAGS). However, I want CMake to look in the local directory *first* to link the executable helloDemo against the lib Hello that has just been built. Thanks for your help, Renaud. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] list of targets
Is it possible to get a list of targets, such as the list of libraries or executables? I have dozens of libraries and executables I need to install as part of my package, and was wondering if there was something easier than adding the install rule for each one by hand. It would be great if I could just get this list, and with a for loop generate the INSTALL command. I've toyed with the notion of replacing ADD_LIBRARY with my own macro ADD_LIBRARY_AND_INSTALL, but the thought of having to deal with and pass along all the parameters of ADD_LIBRARY seems scary and prone to error. Thanks, James ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link directories order
Zitat von Renaud Detry [EMAIL PROTECTED]: Did you try to give the whole path to the lib instead of seperate library name and path? Can that be done without writing the lib suffix explicitly (not cross-platform)? And since you build the lib yourself with a cmake TARGET, the TARGET name should be used as link dependency. I don't see what you mean, could you make this explicit please? Does this have something to do with the INSTALL statement? If not, it is the online example that should be changed. The INSTALL statement has _nothing_ to do with linking the executable. OTOH: why do you shoot yourself in the foot and define linker flags that do not express what you actually want? I defined linker flags that express what I want. I have software installed in non-standard directories like /sw/lib and /usr/local/lib, and I do want CMake to look there (cf. LDFLAGS). However, I want CMake to look in the local directory *first* to link the executable helloDemo against the lib Hello that has just been built. Did you build it using ADD_LIBRARY? If yes: PROJECT(HELLO) ADD_LIBRARY(Hello foo.c) ADD_EXECUTABLE(HelloBin bar.c) TARGET_LINK_LIBRARIES(HelloBin Hello) ADD_LIBRARY defines the TARGET Hello in the above lines. That should link to the local libHello even if you have another version in the system. HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Qt version of Cmake
I have been able to pull the latest CVS sources for CMake (although I had to bounce through another server) and the first issue I have is one with Qt versioning. QtCMake wants 4.3.0 minimum. ParaView ONLY wants 4.2.x. Do you see a problem here? Also, with the problems that Qt is having with OS X 10.5 (something about OpenGL) what are the thoughts from the ParaView developers to moving to a newer version of Qt for ParaView? So I guess I have to have _2_ copies of Qt on my system, (Actually 4, 2 Build, 2 Install). -- Mike Jackson Senior Research Engineer Innovative Management Technology Services On Nov 5, 2007, at 11:02 PM, Bill Hoffman wrote: OPPS So, Clinton Stimpson is also working on one, but did not post to the list I did not realize you had started. Anyway, if you check out CVS CMake and enable the BUILD_QtDialog option, then you can take a look at what is there. It is very close to working at this point. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Include_Directories
Hi List, is there a variable to get all paths specified by Include_Directories. Because I need the path set for a third party programm to run on some source files, before the build is done. And this programm needs a subset of the paths given already in the include_directories command. Is there something like CMAKE_CURRENT_INCLUDE_DIR? Greetings Alexander Please note: This e-mail may contain confidential information intended solely for the addressee. If you have received this e-mail in error, please do not disclose it to anyone, notify the sender promptly, and delete the message from your system. Thank you. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Qt version of Cmake
Mike Jackson wrote: I have been able to pull the latest CVS sources for CMake (although I had to bounce through another server) and the first issue I have is one with Qt versioning. QtCMake wants 4.3.0 minimum. ParaView ONLY wants 4.2.x. Do you see a problem here? Also, with the problems that Qt is having with OS X 10.5 (something about OpenGL) what are the thoughts from the ParaView developers to moving to a newer version of Qt for ParaView? You would have to bring this up on the paraview mailing list. So I guess I have to have _2_ copies of Qt on my system, (Actually 4, 2 Build, 2 Install). 4.3.0 was the first to have the BSD license exception. Also, I guess Clinton is using a feature from 4.3. I don't really have a problem with this. Most people will not be building CMake from source. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Re: FIND_PATH
On Nov 2, 2007 1:28 PM, Leon Moctezuma [EMAIL PROTECTED] wrote: Hi, I created a FindGECKO modul, which tries to look for the NPAPI headers for creating FireFox plug-ins, the problem is that in some distributions the paths have directories with it's version number... for example: /usr/include/firefox-2.0.0.5 /usr/include/nspr4 here is part of the actual script: FIND_PATH(GECKO_ROOT_DIR npapi.h npupp.h /usr/include/firefox /usr/local/include/firefox) FIND_PATH(GECKO_NSPR_DIR prthread.h ${GECKO_ROOT_DIR}/nspr) Is there a way to look for in all FireFox* or nspr* directories? Best regards, Leon Could someone tell me how can I solve this problem? I have libraries that can be for example in /usr/include/firefox and /usr/include/firefox-2.0.0.5, what I want to do is to find the path and look for the headers in all the /usr/include/firefoxXXX directories, or exist a better aproach to what I'm trying to do, please help Leon ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Cvs version 'Segmentation Fault'
Hello all, I've just downloaded the cvs version of Cmake, I built it with the regular version of Cmake (2.4.7). My project uses a ctest script. In this script I set CMake and Ctest path to the Cvs version. When I call the script with the Cvs version of ctest, I get a Segmentation Fault. It is always after the same test (the 99th actually). But when I call the same script with the regular ctest, everything is fine. However I didn't change the Ctest and Cmake path within the script, and I can see that everything is running with the cvs version (the 'Testing' directory is not the same). So that is perhaps a bug of Ctest when there are more than 100 tests. Or is there a solution ? I don't know if everything is really running with the cvs version of ctest, what is dependant from the version that call the script and what is dependant from the version I set in the script ? I also saw an other thing. The cmake's clock doesn't seem to be the same as my computer's one. The folder created within the 'Testing' directory is always one hour less than the real time of test. I didn't see those bugs one the Cmake website, so I can report them, but I would like to know if anybody has a solution before adding an issue. Baptiste ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link directories order
Did you build it using ADD_LIBRARY? If yes: PROJECT(HELLO) ADD_LIBRARY(Hello foo.c) ADD_EXECUTABLE(HelloBin bar.c) TARGET_LINK_LIBRARIES(HelloBin Hello) This is exactly what I have. ADD_LIBRARY defines the TARGET Hello in the above lines. That should link to the local libHello even if you have another version in the system. This is what I thought, too. Unfortunately it doesn't. Renaud. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] QT4_WRAP_UI, INCLUDE_DIRECTORIES and source tree structure
Hi there guys, First off I'm new to cmake (and c++ and qt too :-) ), so please bear this in mind. I'm having some trouble with my source tree layout, and don't know if I'm doing this right. I'll first explain what I've done, and then tell you what's not working. My source tree: project --build --source app --main.cpp -- CMakeLists.txt gui --mainwindow.h --mainwindow.cpp --mainwindow.ui --CMakeLists.txt CMakeLists.txt --CMakeLists.txt Very straight forward, and logical way to layout my source files. I thought. Now, all the open source projects using cmake I found on the net mostly throw all their source files into a single directory, so I couldn't find a proper example for what I want really. The way I thought to do this is to build libraries from some stuff (gui in this case), and then link this into the executable in app. This does work, but maybe there's a more standard way to use cmake on such a source tree? The actual problem I'm having is with includes: ui_*.h files get generated in the gui folder (the one in the build tree of course), and the gui library gets built without problems. The problem though is when including mainwindow.h from main.cpp in the app folder. Because mainwindow.h includes ui_mainwindow.h generated by QT4_WRAP_UI. I do have, INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ) in the CMakeLists.txt file building the gui library. And, like I said, the gui library gets built fine, so it's picking up the ui_mainwindow.h which is in the build tree and not in the source tree. But, when building the app executable, this isn't in the includes any more and the compiler says it can't find ui_mainwindow.h (it's only looking in the source tree I guess). I can solve this by adding, INCLUDE_DIRECTORIES(${project_BINARY_DIR}/source/gui) in the CMakeLists.txt file in the app folder, thus telling it again to go look for the header in the build tree. Even though I already included it earlier on when building the gui library, CMake seems to forget this. Can some please explain to me what is the proper way of using cmake (with Qt4) on more complex source trees, and why my way isn't working properly. Hope you're all having a great day. Regards, cputter ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] can't pipe cl.exe in a custom command
On Nov 6, 2007 8:19 AM, Bill Hoffman [EMAIL PROTECTED] wrote: You might want to look at Modules/Platform/Windows-cl.cmake... It uses EXEC_PROGRAM to get the version of the MS compiler. You could see how that works. Look in CVS CMake. It runs the C preprocessor to obtain a value for _MSC_VER. Probably as good an approach as any, and it was the next thing I was going to try after Juan gave me that list of predefined compiler macros. I was hoping not to have to deal with every compiler macro out there, but it seems I have to deal with differences of command line format and pipe processing anyways. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link directories order
Renaud Detry wrote: Did you build it using ADD_LIBRARY? If yes: PROJECT(HELLO) ADD_LIBRARY(Hello foo.c) ADD_EXECUTABLE(HelloBin bar.c) TARGET_LINK_LIBRARIES(HelloBin Hello) This is exactly what I have. ADD_LIBRARY defines the TARGET Hello in the above lines. That should link to the local libHello even if you have another version in the system. This is what I thought, too. Unfortunately it doesn't. This sounds like a bug. Can you send the output of make VERBOSE=1? -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Cvs version 'Segmentation Fault'
Baptiste Derongs wrote: Hello all, I've just downloaded the cvs version of Cmake, I built it with the regular version of Cmake (2.4.7). My project uses a ctest script. In this script I set CMake and Ctest path to the Cvs version. When I call the script with the Cvs version of ctest, I get a Segmentation Fault. It is always after the same test (the 99th actually). But when I call the same script with the regular ctest, everything is fine. However I didn't change the Ctest and Cmake path within the script, and I can see that everything is running with the cvs version (the 'Testing' directory is not the same). So that is perhaps a bug of Ctest when there are more than 100 tests. Or is there a solution ? I don't know if everything is really running with the cvs version of ctest, what is dependant from the version that call the script and what is dependant from the version I set in the script ? I also saw an other thing. The cmake's clock doesn't seem to be the same as my computer's one. The folder created within the 'Testing' directory is always one hour less than the real time of test. I didn't see those bugs one the Cmake website, so I can report them, but I would like to know if anybody has a solution before adding an issue. Would it be possible for you to run ctest in gdb or some debugger and send a call stack of the crash? -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Conditional dependency
On 2007-11-06 12:44+0100 Hendrik Sattler wrote: Zitat von Eric Noulard [EMAIL PROTECTED]: The general pattern is the following: # put unconditional sources in SET(MYLIB_SRC c.cpp g.cpp any otherunconditional source) # then ADD the conditional ones IF(WIN32) SET(MYLIB_SRC ${MYLIB_SRC} win32-a.cpp) ENDIF(WIN32) IF(LIBXML2_FOUND) SET(MYLIB_SRC ${MYLIB_SRC} xml2-a.cpp) ENDIF() Additionally, I suggest using the LIST macro instead, the above actually reinvents LIST(APPEND ). I would like to clean up the PLplot build system style which has a lot of the former style instead of LIST(APPEND...). However, before I do that work, does anybody know whether LIST(APPEND...) was available for cmake-2.4.5 (the minimum version of cmake for the PLplot build)? To Bill Hoffman: at one time you were keen on committing the results of cmake --help-full for each version of cmake to cvs so that differences (such as when LIST(APPEND) was introduced) would spring out when browsing cvs using the view-cvs GUI diff. Did you ever implement that step in your release process? If so, where do you keep the results of cmake --help-full in cvs? Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Conditional dependency
Alan W. Irwin wrote: However, before I do that work, does anybody know whether LIST(APPEND...) was available for cmake-2.4.5 (the minimum version of cmake for the PLplot build)? To Bill Hoffman: at one time you were keen on committing the results of cmake --help-full for each version of cmake to cvs so that differences (such as when LIST(APPEND) was introduced) would spring out when browsing cvs using the view-cvs GUI diff. Did you ever implement that step in your release process? If so, where do you keep the results of cmake --help-full in cvs? Alex, actually did it, and you can find it here: http://www.cmake.org/Wiki/CMake_Released_Versions Looks like it is there. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link directories order
Renaud Detry wrote: As a result, Demo is linked against an obsolete installed version of Hello, instead of the local fresh one. Note that /tmp/lib was empty when I ran cmake. [EMAIL PROTECTED] $ export LDFLAGS=-L/tmp/lib OK, CMake does not know what you are doing here. It is treating LDFLAGS like some linker flag. The idea was something like -64 or some other linker specific flag for a platform. If you inject directories into the link line, you are sort of out of luck. Why are you doing it this way? -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link directories order
Renaud Detry wrote: Did you build it using ADD_LIBRARY? If yes: PROJECT(HELLO) ADD_LIBRARY(Hello foo.c) ADD_EXECUTABLE(HelloBin bar.c) TARGET_LINK_LIBRARIES(HelloBin Hello) This is exactly what I have. ADD_LIBRARY defines the TARGET Hello in the above lines. That should link to the local libHello even if you have another version in the system. This is what I thought, too. Unfortunately it doesn't. This sounds like a bug. Can you send the output of make VERBOSE=1? Here's the term output (at the end), and a word about the build context: [...] I understand cmake smart-orders link directory flags. However, flags coming from the shell env LDFLAGS don't seem to be taken into account in this smart sort. To illustrate the issue, I slightly modified the example code from http://www.cmake.org/HTML/cmakeExample.tar.gz The only change is in cmakeExample.tar.gz:CMakeExample/Hello/CMakeLists.txt which becomes # Create a library called Hello which includes the source file hello.cxx. # The extension is already found. Any number of sources could be listed here. add_library (Hello hello.cxx) INSTALL(TARGETS Hello RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) As one can see in the attached terminal output, the linker for Demo looks in /tmp/lib before looking in the build dir: /usr/bin/c++ -headerpad_max_install_names -fPIC -L/tmp/lib CMakeFiles/helloDemo.dir/demo.o CMakeFiles/helloDemo.dir/demo_b.o -o helloDemo -L/Volumes/Data/Users/detryr/tmp/CMakeExample/Hello -lHello As a result, Demo is linked against an obsolete installed version of Hello, instead of the local fresh one. Note that /tmp/lib was empty when I ran cmake. [EMAIL PROTECTED] $ export LDFLAGS=-L/tmp/lib [~/tmp/ CMakeExample] [EMAIL PROTECTED] $ rm /tmp/lib/libHello.a [~/tmp/ CMakeExample] rm: /tmp/lib/libHello.a: No such file or directory [EMAIL PROTECTED] $ cmake -DCMAKE_INSTALL_PREFIX=/tmp [~/tmp/ CMakeExample] -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Check size of void* -- Check size of void* - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Configuring done -- Generating done -- Build files have been written to: /Volumes/Data/Users/detryr/tmp/ CMakeExample [EMAIL PROTECTED] $ make VERBOSE=1 [~/tmp/ CMakeExample] /usr/local/cmake-2.4.7-Darwin-universal/bin/cmake -H/Volumes/Data/ Users/detryr/tmp/CMakeExample -B/Volumes/Data/Users/detryr/tmp/ CMakeExample --check-build-system CMakeFiles/Makefile.cmake 0 Clearing dependencies in Hello/CMakeFiles/Hello.dir/depend.make. Clearing dependencies in Hello/CMakeFiles/Hello.dir/depend.internal. Clearing dependencies in Demo/CMakeFiles/helloDemo.dir/depend.make. Clearing dependencies in Demo/CMakeFiles/helloDemo.dir/ depend.internal. /usr/local/cmake-2.4.7-Darwin-universal/bin/cmake -E cmake_progress_start /Volumes/Data/Users/detryr/tmp/CMakeExample/ CMakeFiles 3 make -f CMakeFiles/Makefile2 all make -f Hello/CMakeFiles/Hello.dir/build.make Hello/CMakeFiles/ Hello.dir/depend Scanning dependencies of target Hello cd /Volumes/Data/Users/detryr/tmp/CMakeExample /usr/local/ cmake-2.4.7-Darwin-universal/bin/cmake -E cmake_depends Unix Makefiles /Volumes/Data/Users/detryr/tmp/CMakeExample /Volumes/Data/ Users/detryr/tmp/CMakeExample/Hello /Volumes/Data/Users/detryr/tmp/ CMakeExample /Volumes/Data/Users/detryr/tmp/CMakeExample/Hello / Volumes/Data/Users/detryr/tmp/CMakeExample/Hello/CMakeFiles/Hello.dir/ DependInfo.cmake make -f Hello/CMakeFiles/Hello.dir/build.make Hello/CMakeFiles/ Hello.dir/build /usr/local/cmake-2.4.7-Darwin-universal/bin/cmake -E cmake_progress_report /Volumes/Data/Users/detryr/tmp/CMakeExample/ CMakeFiles 1 [ 33%] Building CXX object Hello/CMakeFiles/Hello.dir/hello.o /usr/bin/c++-o Hello/CMakeFiles/Hello.dir/hello.o -c /Volumes/ Data/Users/detryr/tmp/CMakeExample/Hello/hello.cxx Linking CXX static library libHello.a cd /Volumes/Data/Users/detryr/tmp/CMakeExample/Hello /usr/local/ cmake-2.4.7-Darwin-universal/bin/cmake -P CMakeFiles/Hello.dir/ cmake_clean_target.cmake cd /Volumes/Data/Users/detryr/tmp/CMakeExample/Hello /usr/local/ cmake-2.4.7-Darwin-universal/bin/cmake -E cmake_link_script CMakeFiles/Hello.dir/link.txt --verbose=1 /usr/bin/ar cr libHello.a CMakeFiles/Hello.dir/hello.o /usr/bin/ranlib libHello.a /usr/local/cmake-2.4.7-Darwin-universal/bin/cmake -E cmake_progress_report /Volumes/Data/Users/detryr/tmp/CMakeExample/ CMakeFiles 1 [ 33%] Built target Hello make -f Demo/CMakeFiles/helloDemo.dir/build.make Demo/CMakeFiles/ helloDemo.dir/depend Scanning dependencies of target helloDemo cd /Volumes/Data/Users/detryr/tmp/CMakeExample /usr/local/ cmake-2.4.7-Darwin-universal/bin/cmake -E cmake_depends Unix Makefiles /Volumes/Data/Users/detryr/tmp/CMakeExample /Volumes/Data/
[CMake] Import libraries prefix bug under windows?
Hi, I have been using CMake for quite a while now under Linux/MacOSX/Cygwin for a large project. Recently I have been trying to make it work under Windows, using the freely available to download Windows SDK. (cmake -G NMake Makefiles) I encountered a small problem, which might be a CMake bug. (I am using the latest cmake 2.4.7) I ask CMake to produce a dll (let say foo.dll), and then I want to link this dll to produce an executable bar.exe. I also changed the prefixes of the dll using: SET(CMAKE_SHARED_LIBRARY_PREFIX lib) SET(CMAKE_IMPORT_LIBRARY_PREFIX lib) So in fact, the dll generated is libfoo.dll (which is right). An import library is also generated (libfoo.lib) (which is still right). But then when the makefile generated by CMake wants to link and produce bar.exe, the linker complains that it did not find foo.lib. It seems it completely ignore the given prefix of the dll here. Moving libfoo.lib to foo.lib and resuming the compilation works. Not having a prefix also works. So I would say it is a bug. In fact, I am not sure at all of this CMAKE_IMPORT_LIBRARY_PREFIX: whatever I put there is ignored for the production of libfoo.lib (it is always libfoo.lib which is produced, according to what it is given by CMAKE_SHARED_LIBRARY_PREFIX) Ronan. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Include_Directories
On Tuesday 06 November 2007, [EMAIL PROTECTED] wrote: Hi List, is there a variable to get all paths specified by Include_Directories. Because I need the path set for a third party programm to run on some source files, before the build is done. And this programm needs a subset of the paths given already in the include_directories command. Is there something like CMAKE_CURRENT_INCLUDE_DIR? GET_DIRECTORY_PROPERTY(var INCLUDE_DIRECTORIES) Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] QT4_WRAP_UI, INCLUDE_DIRECTORIES and source tree structure
On Wednesday 07 November 2007, Christiaan Putter wrote: Thanks for the reply Alexander, I've tried both and , though makes more sense since ui_*.h isn't in the source tree and cmake should be telling the compiler where to look for it. Then you need to add the include path. So when using INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ), how long does that stay in the include directories? Is it local to the current CMakeLists file? Why? It is for that file and it is inherited tp all subdirectories (via ADD_SUBDIRECTORY) Obviously adding the include directory myself works, though it seems to defeat the entire purpose of using cmake if I have to keep track of my header files in the end myself in any case. Should one rather have all the You need to tell cmake which include dirs to use, it can't do that automatically. Bye Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Building cmake to use stlport / Solaris
Hello, I am trying to install cmake 2.4.7 on a solaris (5.8) machine. It bootstraps ok but fails with: [ 7%] Built target testFail Linking CXX executable ../../bin/testHashSTL Undefined first referenced symbol in file cmsys::_stl_prime_list /tmp/cmake-2.4.7/Source/kwsys/CMakeFiles/testHashSTL.dir/SunWS_cache/CC_obj_J/J9Fj1L8fhxCtuQTN9w2u.o [Hint: static member cmsys::_stl_prime_list must be defined in the program] I think this is to do with STL being old or not so good on this platform. I could be wrong. We have stlport installed. Can anyone tell me how to point cmake bootstrap at our stlport? I tried CMAKE_INCLUDE_PATH=... CMAKE_LIBRARY_PATH=... ./bootstrap ... but that didn't work. Thanks for any tips Andrew __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Linking problem
Hi, I'm not 100% sure this is really a CMake related question, but I'll fire it up anyway: I'm building a series of static libraries, name them liba.a, libb.a and libc.a, and linking them into a shared library libfoo.so. Then I'm building libx.a liby.a and libz.a and linking them into the shared libbar.so. Then I have an executable whatever.exe that's linked to to libfoo.so and libbar.so. The linking of the executable fails complaining of certain missing simbols. Some symbols from liba.a are missing in libbar.so. So far I have fixed the issue by linking one of the libs of libfoo.so (say libx.a) to libbar.so. But this smells of nasy workaround. Obviously I'm doing something wrong here, so could anyone please help? Thanks! -- Salvatore Iovene http://www.iovene.com/ Key Fingerprint: 5647 944D D5AD 2E87 00B4 7D54 2864 359D FF20 16D8 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] Include_Directories
Hi Alex, List, is there a variable to get all paths specified by Include_Directories. Because I need the path set for a third party programm to run on some source files, before the build is done. And this programm needs a subset of the paths given already in the include_directories command. Is there something like CMAKE_CURRENT_INCLUDE_DIR? GET_DIRECTORY_PROPERTY(var INCLUDE_DIRECTORIES) Works great. Now I can do that for every module in a common macro. Thanks for your help. Greetings Alexander Please note: This e-mail may contain confidential information intended solely for the addressee. If you have received this e-mail in error, please do not disclose it to anyone, notify the sender promptly, and delete the message from your system. Thank you. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake