[CMake] Release build from bootstrap?
When I run 'bootstrap' followed by 'make' on a cmake source tree, I get a debug build of the 'cmake' binary. If I have an existing CMake available, I can build cmake by setting CMAKE_BUILD_TYPE=Release and I end up with a release build of the new CMake. Is it possible to get a release build directly out of the bootstrap procedure? Thanks, David -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Best way to show/include CMake files in IDE
On Mon, Mar 7, 2016 at 9:19 PM, Eric Wingwrote: > On 3/7/16, Eric Wing wrote: > > On 3/7/16, David Cole wrote: > >> If you include those files in the source list for a library, executable, > >> or > >> custom target, they should show up in IDE projects, and they should be > >> ignored by Makefile type projects. Have you tried that? > >> > >> > >> David > >> > > > > I haven't tried it yet since I was wondering what the best approach was > :) > > Since some of my files are somewhat project oriented instead of target > > oriented, I wasn't sure if putting them the library/executable targets > > was best. But if it is, I'll try that. > > > > Thanks, > > Eric > > > > Well, I gave it a try. So far, it looks good. > > Thanks, > Eric > I usually do this to make my IDE aware of files: add_custom_target(MyProject_HDRS SOURCES MyHeader.h MyImplementation.hpp) It sounds like David says you can do the same for your .cmake files. This is pretty awkward though - it seems like there should be more of an explicit function for this, something like: add_files_to_IDE(MyHeader.h MyImplementation.hpp) This would make it much more clear what this line is for and would prevent forcing this "abuse" of the concept of a target for a very common use case. David -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Running TEST_P from GTest with CMake
I have been successfully using CMake's GTEST_ADD_TESTS to run GTest TEST and TEST_F blocks defined in a source file. However, I now need to pass some arguments (filenames that I want CMake to produce including things like ${CMAKE_SOURCE_DIR}) to the GTests, and it seems like the way to do this is with INSTANTIATE_TEST_CASE_P that calls TEST_P blocks with a list of parameters. It seems like GTEST_ADD_TESTS does not handle this. Does anyone know how to do something like this through CMake? Thanks, David -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] QT, CMake and ITK
On Tue, Apr 23, 2013 at 5:03 PM, Gabriel Santiago santiago.eletr...@gmail.com wrote: Dear all, I am trying to create an user interface for some medical image processing using Qt (it must be Qt) and I want to use ITK to do some of the image processing. In order to create the CMakeLists.txt, I am following this tutorial: http://qtnode.net/wiki/Qt4_with_cmake Everything goes fine when I hit Configure with CMake-GUI. All the fields of QT are filled and no problems are found. but when I try to Generate the files, I get the following message: CMake Error: CMake can not determine linker language for target:Test CMake Error: Cannot determine link language for target Test. I guess that CMake doens't find the programming language that I want to use. Am I right? In any case, how can I solve this problem? Could someone, please, provide me some CMakeFiles complete example for this case? Thank you all in advance, -- Gabriel Santiago Please post your CMakeLists.txt file. David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Error compiling VTK example
On Mon, Mar 4, 2013 at 4:48 AM, a.c.sant acsant...@gmail.com wrote: Hi, I'm trying to compile a simple VTK example from their web (ProjectPointPlane) with MingW. I downloaded the example and the CMakeLists.txt file. When running CMake-gui, I can generate the Makefile without any errors. However, when I run mingw32-make.exe from the terminal, I got several errors. Here's the output: Do you know what might the problem be? Thanks! It doesn't seem like you've attached the output? Also, this question is probably better suited for the VTK mailing list. David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Problem with Visual Studio 2010, Windows 7 64bit
On Wed, Nov 28, 2012 at 4:22 AM, Andrew Maclean andrew.amacl...@gmail.com wrote: Interesting ... I have no problems, the only thing I can think of is that I had VS 2010 SP1 installed before I installed VS 2012 Express, I did not use any of the RC versions. Petr, A colleague mentioned that with the same setup he was getting the same error, and then installed SP1 for VS 2010 and things started working. It would really be great if there were better checks/errors because it is really a huge barrier for projects like VTK to get users to fight through install problems. Hey you should use VTK for that works when they have to follow a few instructions and it works, but when they have to spend days working through cryptic errors most tend to give up and then we lose a user. Andrew, I'm almost certain that it will never work using the VS generators (with very different can't find the compiler type of errors) unless you run cmake-gui from a terminal unless you have manually added many VS things to the system environment variables. At least that has been my experience on many machines. David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Problem with Visual Studio 2010, Windows 7 64bit
On Wed, Nov 28, 2012 at 9:14 AM, John Drescher dresche...@gmail.com wrote: A colleague mentioned that with the same setup he was getting the same error, and then installed SP1 for VS 2010 and things started working. I also remember that Visual Studio 2012 RTM had an optimizer bug that caused Qt applications to crash so the first thing I always do after installing VS 2010 is install SP1. John Is there a way to have CMake detect this sort of thing and say It is not working, and it looks like it is because you are using VS2010 without SP1.? These are the kinds of errors that users don't mind seeing as much. The error that I posted in the first email of this thread means nothing to the average user and causes major headaches. Also, I don't think it should depend on the user having installed VS with any particular environment settings - the typical case I run into is someone who already is perfectly happy with their VS setup that I tell to use CMake to do something. They then run into these problems and shouldn't have to reinstall it just to use CMake. Perhaps a guide to how to setup your environment so that VS still works as usual but CMake is also happy would be a nice addition, or even a button in CMake somewhere to Setup the environment to allow VS to be found properly. Linux users are annoyed but often know what to do when you ask them to manipulate environment variables, but in my experience Windows users (of course not Windows open source devs, but typical Windows users) don't even know where to go to change environment variables, so asking them to get them right manually doesn't seem like a good plan. David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Problem with Visual Studio 2010, Windows 7 64bit
I am trying to build VTK for the first time on a 64bit Windows 7 system. I have Visual Studio 2010 installed. I ran the 64bit Visual Studio Command Prompt and ran 'cmake-gui' from it. I pointed it to the VTK source directory and gave it a build directory. When I configure, I get: --- Error in configuration process, project files may be invalid The C compiler identification is MSVC 16.0.30319.1 The CXX compiler identification is MSVC 16.0.30319.1 Check for working C compiler using: Visual Studio 10 Win64 Check for working C compiler using: Visual Studio 10 Win64 -- broken CMake Error at C:/bin/cmake/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler D:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe is not able to compile a simple test program. It fails with the following output: Change Dir: c:/build/VTK/CMakeFiles/CMakeTmp Run Build Command:d:\PROGRA~2\MICROS~1.0\Common7\IDE\devenv.com CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec2926210968 Microsoft (R) Visual Studio Version 10.0.30319.1. Copyright (C) Microsoft Corp. All rights reserved. 1-- Build started: Project: cmTryCompileExec2926210968, Configuration: Debug x64 -- 1 Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64 1 Copyright (C) Microsoft Corporation. All rights reserved. 1 1 cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D CMAKE_INTDIR=\Debug\ /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /FocmTryCompileExec2926210968.dir\Debug\\ /FdC:/build/VTK/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec2926210968.pdb /Gd /TC /errorReport:prompt testCCompiler.c /Zm1000 1 1 testCCompiler.c 1LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt == Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped == CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project) Configuring incomplete, errors occurred! --- I am using cmake-2.8.10.1. Any suggestions? David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Output assembly (g++ -S)
I am trying to produce the .s file that g++ -S file.cpp would produce, but on a CMake target (because I want the include path that I've setup through CMake, etc.) Consider a simple demo: PROJECT(Assembly) ADD_EXECUTABLE(Assembly Assembly.cpp ) # this produces an 'Assembly' executable I tried to do this: SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -S) but I get: Linking CXX executable AssemblyAssembly c++: warning: CMakeFiles/Assembly.dir/Assembly.cpp.o: linker input file unused because linking not done I also tried: set_target_properties(Assembly PROPERTIES COMPILE_FLAGS -S) but I get: file format not recognized; treating as linker script Any suggestions on how to do this? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Output assembly (g++ -S)
CMake has targets to do that. If you type make help you can see them. It should be something like this: make Assembly.s -Bill Ah, so easy. Thanks Bill! David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Modifying a variable's value without resetting the docstring
Well, if ${_var} is already a cache variable, you can retrieve it's HELPSTRING property to see what was set as the original doc string. But if it's not, then there won't be one, and you'll be adding an undocumented option... http://cmake.org/cmake/help/v2.8.9/cmake.html#section_PropertiesonCacheEntries Thanks Dave, that'll work: get_property(currentHelpString CACHE ${_var} PROPERTY HELPSTRING) set(${_var} OFF CACHE BOOL ${currentHelpString} FORCE) -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Modifying a variable's value without resetting the docstring
Is there a way to use the FORCE argument to set() without resetting the docstring? I tried: cmake_minimum_required(VERSION 2.6) PROJECT(CacheForce) # Create a variable set(MyVariable OFF CACHE BOOL Description goes here. FORCE) # Change the value set(MyVariable ON CACHE FORCE) # error: set given invalid arguments for CACHE mode. . I was hoping not to have to re-specify the type (BOOL) either. It seems like it is just asking for things to get out of sync by having to set the docstring in more than one place. Is there a way to do this? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Modifying a variable's value without resetting the docstring
On Fri, Sep 21, 2012 at 1:44 PM, David Cole david.c...@kitware.com wrote: You should avoid using FORCE in the first place. :-) But if you have to use it, then you should provide the type and documentation along with the call that uses FORCE. If you have multiple calls that require this information, consider using variables to eliminate the duplication and reference the variables from the multiple calls. I am using FORCE to do this: http://www.itk.org/Wiki/CMake/Tutorials/SettingVariableGroups You can see that my set(...FORCE...) call occurs inside of a foreach: set(${_var} OFF CACHE BOOL test FORCE) I guess to use your suggestion of making a variable that stores the docstring once and referencing it from multiple places I would have to use the CMake map emulation for this (http://www.cmake.org/Wiki/CMake:VariablesListsStrings#Emulating_maps) ? Sound like the right thing to do? Or is there an entirely better way to go about this :) ? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Setting up environment for CMake GUI to use Visual Studio generator
When using Visual Studio 10 as the generator from the CMake GUI, it complains that it can't find 'cl' (To use the NMake generator, cmake must be run from a shell that can use the compiler cl from the command line.) It works if I use: cmake -G NMake Makefiles from the VS command line, so I'm assuming it is just an environment problem. Why doesn't CMake setup the environment automatically when you choose the generator? Are there any instructions on how to setup the environment for this? It seems like a super standard thing to do, no? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Setting up environment for CMake GUI to use Visual Studio generator
On Fri, Sep 14, 2012 at 11:56 AM, David Cole david.c...@kitware.com wrote: Run cmake-gui FROM the target environment, just like you run cmake... i.e. : type cmake-gui in the cmd prompt that has your stuff set up in it. Don't just launch it from a short-cut unless you're using the Visual Studio * generators. Those do not need any special environment. Many of the makefile ones do. Thanks David, that does the trick. David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] 'make' does nothing in msys?
I am trying to build ITK using MinGW. (I'm writing some guides on how to build ITK with different toolchains). Here is what I've come up with so far: http://www.itk.org/Wiki/ITK/Configuring_and_Building/MinGW Up until this point, everything seems to go smoothly (configure and generate complete successfully). However, when I run 'make' from the msys shell in the ITK build directory (after generating with the MinGW generator), it does nothing. There are no errors, but it just immediately returns me to the terminal. The one thing that does happen is that the 'user@machine ~' is green and yellow, but after running 'make' everything changes to white. I'm assuming this has something to do with CMake, that is why I'm asking here :) Any clues? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] 'make' does nothing in msys?
On Fri, Sep 14, 2012 at 1:34 PM, David Doria daviddo...@gmail.com wrote: I am trying to build ITK using MinGW. (I'm writing some guides on how to build ITK with different toolchains). Here is what I've come up with so far: http://www.itk.org/Wiki/ITK/Configuring_and_Building/MinGW Up until this point, everything seems to go smoothly (configure and generate complete successfully). However, when I run 'make' from the msys shell in the ITK build directory (after generating with the MinGW generator), it does nothing. There are no errors, but it just immediately returns me to the terminal. The one thing that does happen is that the 'user@machine ~' is green and yellow, but after running 'make' everything changes to white. I'm assuming this has something to do with CMake, that is why I'm asking here :) Any clues? Thanks, David I found and used the MSYS generator, and after adding msys/bin to PATH, it worked as I expected. I also found that with the MinGW generator, it worked properly by running 'mingw32-make' rather than just 'make'. I am still confused as to why it didn't complain that 'make' was not found (no such file, etc), but these two methods seem to work: http://www.itk.org/Wiki/ITK/Configuring_and_Building/MinGW If anyone can comment about this lingering question, verify that these two techniques are reasonable, or explain the difference between the two, that would be great :) David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Boost_DIR
On Wed, Jan 11, 2012 at 5:55 AM, Daniel Dekkers d.dekk...@cthrough.nl wrote: Hi, does anyone know what this “Boost_DIR” variable is from the findBoost.cmake module? And why it is never found? Everything works well, I use BOOST_ROOT to set the path to the Boost distribution, just curious. Daniel I would like to revive this question. When I do this: FIND_PACKAGE(Boost 1.51 COMPONENTS program_options required) I see a variable Boost_DIR that gets set to Boost_DIR-NOTFOUND, even though Boost_INCLUDE_DIR, Boost_LIBRARY_DIRS, and a whole bunch of other variables are set correctly, and the project builds correctly. Is there something else you have to do to get Boost_DIR to not say NOTFOUND? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Boost_DIR
On Wed, Sep 5, 2012 at 2:16 PM, Klaim - Joël Lamotte mjkl...@gmail.com wrote: I might be wrong but my understanding is that it's the other way arround: you provide Boost_DIR (root of your boost installation) and it finds the rest itself. I've been using it like that. I have a custom build of boost in a specific directory and an environnement variable Boost_DIR set to it. I also set Boost_ROOT to be sure because previous versions of CMake would look for it. Joel Lamotte Joel, I tried that - with export Boost_DIR=/home/doriad/build/Boost_1_51/ in my ~/.profile and using: FIND_PACKAGE(Boost 1.51) ccmake still shows: Boost_DIR =*Boost_DIR-NOTFOUND But as I mentioned, Boost_INCLUDE_DIR and Boost_LIBRARY_DIRS are set correctly, and everything builds fine. It is just terribly confusing for one of the first things a user sees in ccmake is Boost_DIR-NOTFOUND, even though everything is configured properly! David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Add header files to project when there are no cpp files
I have just started using QtCreator. When I open a CMake project in QtCreator, all of my cpp files mentioned in the CMakeLists.txt are added to the project. However, my headers (.h) and template implementation (.hpp) are not added to the project (I believe this is the same behavior as Visual Studio). I have seen this thread: http://www.cmake.org/pipermail/cmake/2003-January/003274.html that says you can simply add the headers to the add_executable/add_library line: add_library(MyProject main.cpp MyClass.h MyClass.cpp) This works fine. However, I have several projects that are template only (there are no .cpp files), and I essentially only use them as git submodules, so there are actually no driver cpp files either (the drivers are in the project that includes the submodule). That is, the complete directory looks like this: MyProject/CMakeLists.txt MyProject/MyProject.h Because of this, I can't use add_executable or add_library at all. Is there another command that can get CMake to add these files to the project? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Add header files to project when there are no cpp files
Not sure if it works with QtCreator or not, but you should be able to add_custom_target and use the SOURCES argument to get source files to show up in the generated project. Ah, thanks. I had tried: add_custom_target(MyProject MyProject.h) but not: add_custom_target(MyProject SOURCES MyProject.h) It does do the trick for QtCreator. Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Link errors on Wiki/CMake
On Tue, Jul 17, 2012 at 9:34 AM, Micha Renner micha.ren...@t-online.dewrote: The following links of www.cmake.org/Wiki/CMake generate 404 Errors How CMake simplifies the build process by Bruno Abinader Part 1 - Basic build system : http://www.abinader.com.br/bruno/how-cmake-simplifies-the-build-process-part-1-basic-build-system/ Howto use cmake with C/C++ projects: http://snikt.net/index.php/2010/04/01/howto-use-cmake-with-cc-projects The Hacker Within: Build Systems: http://hackerwithin.org/thw/plugin_wiki/page/buildsystems CMakeListGenerator (Win32) http://www.vanvelzensoftware.com/postnuke/index.php?name=Downloadsreq=viewdownloadcid=7 Server not found Slightly newer version here vcproj2cmake.rb http://dgwarp.hd.free.fr/vcproj2cmake.rb generates a black pdf: Media:CTest Running Modes.pdf http://www.cmake.org/Wiki/images/0/0a/CTest_Running_Modes.pdf greetings Micha I an confirm all but the last - the PDF ( http://www.cmake.org/Wiki/images/0/0a/CTest_Running_Modes.pdf) seems to work for me. If no one corrects these links within a reasonable time frame, I'd vote they be deleted. David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Linking to libraries that depend on other libraries
On Thu, May 17, 2012 at 2:18 AM, Petr Kmoch petr.km...@gmail.com wrote: Hi David, there's a target property LINK_INTERFACE_LIBRARIES (and per-configuration variants) which can be used for this purpose. Starting with 2.8.7, target_link_libraries() also accepts LINK_INTERFACE_LIBRARIES as a new argument mode, setting the property instead of linking. Petr Petr, I tried the following, but in both cases (target_link_libraries and set_target_properties) I still get a linker error that it can't find TestB(). cmake_minimum_required(VERSION 2.6) PROJECT(Test) add_library(TestB TestB.cpp) # TestA depends on TestB add_library(TestA TestA.cpp) #target_link_libraries(TestA LINK_INTERFACE_LIBRARIES TestB) set_target_properties(TestA PROPERTIES LINK_INTERFACE_LIBRARIES TestB) # I want to link to TestA and have it automatically also link to TestB add_executable(Test Test.cpp) target_link_libraries(Test TestA) I have uploaded the entire demo project here: http://homepages.rpi.edu/~doriad/Upload/TestCMake.tar.gz Any ideas? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] How to handle a submodule existing twice in a project?
I have a main project (called Test) that has two submodules, TestA and TestB. TestA also has a submodule, which is exactly the same TestB. So there is a directory Test/TestB as well as Test/TestA/TestB In TestA/CMakeLists.txt, I have add_subdirectory(TestB). In Test/CMakeLists.txt, I have add_subdirectory(TestA) as well as add_subdirectory(TestB). CMake complains that it cannot create TestB because another target with the same name already exists (which it does). What is the right way to handle this? I always assume that TestB is identical in both places (which might not be a great assumption...), so I guess I just want, in both places, to say include TestB if it already hasn't been included. I tried to do that by replacing the add_subdirectory(TestB) calls with: if(NOT TestB_SOURCE_DIR) add_subdirectory(TestB) endif() but then the linker complains that it can't find TestB. I have uploaded a demo project here: http://homepages.rpi.edu/~doriad/Upload/TestCMake2.tar.gz Thanks! David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to handle a submodule existing twice in a project?
Why are you doing that? If TestB is always available as sub-dir under TestA it doesn't make much sense to also add it as a subdirectory of the parent of TestA - IMHO. Test/CMakeLists.txt can still use all targets from TestB, since target names are always valid across the complete project. Since TestA is a submodule, it should always be present in the sources anyway. Andreas I use functionality of TestB in Test. If TestA decides to remove TestB, then Test will break. I was trying to hide the implementation of TestA by requiring both TestA and TestB to be submodules of Test, regardless of whether or not TestA has TestB as a submodule of its own. See what I mean? David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to handle a submodule existing twice in a project?
Yeah. Well, in that case I'd simply check for the TestB target thats defined in TestB/CMakeLists.txt as condition for the top-levels add_subdirectory: if(NOT TARGET TestB) add_subdirectory(TestB) endif() That should work. Andreas Awesome, that seems to do the trick. Thanks! David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Linking to libraries that depend on other libraries
I have a library, libA, that depends on another library, libB, with this structure: My Program - libA - libB In my program, if I only link to libA, I get linker errors that it can't find things in libB, and these errors are fixed if I also link My Program to libB. This makes sense, but is there any way to avoid it with CMake? That is, a command that I can put in libA (created with add_library) that says when something links to me (libA), also/automatically link it to libB? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Checking if git submodules have been initialized
I have recently started using git submodules in my projects. I have had multiple complains from my users It gives me a missing xyz.h type of error when I try to compile. The reason is that they haven't initialized the submodules (like it says to do in the readme :) ). Is there a CMake way to check if a submodule is initialized so I can throw a more appropriate error - Please initialize the xyz submodule instead of letting the error get all the way to the compiler? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Accessing the CMAKE_CXX_FLAGS that a project was built with?
I use ITK in my project. I want to determine if the ITK build that the user has selected to use (via cmake ITK_DIR) has been built with a particular compiler flag, namely -DCMAKE_CXX_FLAGS=-std=gnu++0x Is there a way to do this via cmake in my project? David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Multiple tests in a single file
Does CTest have a mechanism to run man mini-tests in a single file? I'm looking for something equivalent to the UnitTest++ syntax: TEST(YourTestName) {} TEST(YourOtherTestName){} int main(){ return UnitTest::RunAllTests();} Of course you could do something like: int YourTestName() { } int YourOtherTestName() { } int main() { YourTestName(); YourOtherTestName(); } but then you have to manually output the name of the test if it fails, you could forget to call one of the tests, etc. Is there anything like this for CMake/CTest? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple tests in a single file
On Fri, Jan 6, 2012 at 5:54 PM, Jean-Christophe Fillion-Robin jchris.filli...@kitware.com wrote: Hi David, Not too long ago I was browsing the project of a friend who worked on BTK (The toolkit used by Mokka, a motion kinematic kinetic analyser) [1]. I noticed that he is using cxxtest [2] along with ctest. It seems it could to address the use case you are describing. See Example integration [3] and cxxtest source [4] Hth Jc [1] https://b-tk.googlecode.com/svn/web/mokka/index.html [2] http://cxxtest.tigris.org/ [3] https://code.google.com/p/b-tk/source/browse/BTK/trunk/Testing/Code/C3DFileReaderTest.h [4] https://code.google.com/p/b-tk/source/browse/#svn%2FBTK%2Ftrunk%2FUtilities%2FCxxTest%2Fcxxtest Thanks Jean-Christophe. So I guess the short answer is ctest can't do this. It seems they have made significant modifications to CxxTest so that the bin/cxxtestgen that ships with CxxTest is no longer required (they've replaced it with C macros). I like the BTK way better :) I guess I'm not sure what the advantage of using CTest along with something like CxxTest is. If you build an executable using CMake, then why not just run ./MyTests from the terminal instead of making an interface so that you can call 'ctest'. CTest will report a single pass or fail, because as far as it is concerned there is only one test, right? The relevant file is https://code.google.com/p/b-tk/source/browse/BTK/trunk/Testing/Code/CMakeLists.txt that only has one add_test call. Any thoughts? David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Running coverage analysis
On Tue, Jan 3, 2012 at 9:52 AM, David Cole david.c...@kitware.com wrote: To actually run the coverage testing, you need to have tests added with add_test in your CMakeLists file, then you need to run a ctest -S script that calls ctest_coverage, or use one of the predefined coverage dashboard targets. (Use 'make help | grep Coverage' to see those.) When I run 'make help' from that example project's build dir I just see doriad@david-lab:~/build/Examples/CTest/Coverage$ make help The following are some of the valid targets for this Makefile: ... all (the default if no target is provided) ... clean ... depend ... Coverage ... edit_cache ... rebuild_cache ... test ... coverage.o ... coverage.i ... coverage.s I also ran 'make help | grep Coverage' in the VTK build dir (because I'd assume the dashboard targets you're talking about would be in a big project like VTK) but there is no output. Are these dashboard targets project specific? That is, if I'm working on a project that does not have a dashboard server, how would you see the coverage report? It'd be great if someone could add a simple example script that calls ctest_coverage to this example, along with the procedure to run it and inspect the result: http://www.cmake.org/Wiki/CTest/Coverage/Example David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Running coverage analysis
I found this wiki page: http://www.vtk.org/Wiki/CTest/Coverage#Coverage_With_C.2B.2B that explains the flags that are necessary. I set up a demo project here and it compiles: http://www.vtk.org/Wiki/CTest/Coverage/Example However, how do you actually run the coverage analysis? I ran 'ctest' but there are no magic tests that were setup. Are there more instructions somewhereon performing and viewing the coverage? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] FindQtMobility
It looks like this find script has been written for kde: http://old.nabble.com/Review-Request%3A-Add-a-FindQtMobility.cmake-file-td31823359.html I don't see it included in src/cmake/Modules - any plans to include it with CMake? David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] New type of cache variable: lists
On Tue, Dec 6, 2011 at 4:19 PM, Robert Dailey rcdai...@gmail.com wrote: Has anyone thought of creating a LIST type for cache variables? In CMake GUI on Windows, this would be represented by a combo-box or drop-down box that allows the user to pick one item out of a list of available items. Is this possible? I definitely agree. An immediate use case is for the CMAKE_BUILD_TYPE variable. I added a feature request here a while back: http://public.kitware.com/Bug/view.php?id=11806 David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Automatically pull in dependencies from QtDesigner plugins
On Sun, Dec 4, 2011 at 11:34 AM, Michael Jackson mike.jack...@bluequartz.net wrote: Do you have MyWidget packaged as a true library, or did you just create the Designer Plugin and then have a loose .cpp/.h file? The is a project called Qwt* that has a similar setup. It has a Designer plugin for its various widgets and it has a qwt.dylib/.dll/.so that your program links against. You might be able to use this type of workflow for your project. In rough form this is what I am suggesting: Create a MyWidget project that builds the Designer plugin and a dynamic library. When the project installs it will install its headers and library under its own install location and also install the Designer plugin into the appropriate location inside the Qt distribution you are using. The MyWidget would also include the necessary CMake EXPORT files or what ever so other projects can use it. In the project that actually _uses_ MyWidget, you call find_package(MyWidget) which will setup all the necessary include directories and MyWidget_LIBRARIES variables. *Normal Qwt at Sourceforge does NOT use CMake as a build system. I have created a CMake build system for Qwt which is located on my public git-web server. Hope some of that helps. Thanks Mike, I tried simply placing the Widget in a subdirectory called Widget. I got it to work, but I am confused about one thing. If in the main project CMakeLists.txt I add: add_subdirectory(Widget) and then in Widget/CMakeLists.txt I add: include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) I get errors that LabeledSlider.h can't find ui_LabeledSlider.h, and main.cpp can't find LabeledSlider.h (problems with uic). However, if instead I add directly to the main project CMakeLists.txt: include_directories(${CMAKE_CURRENT_BINARY_DIR}/Widget) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Widget) it works fine. Can you explain the difference between these two methods of adding the include directories? I have setup both cases here: http://daviddoria.com/Uploads/QtSubdirectory.tar.gz Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Automatically pull in dependencies from QtDesigner plugins
I have created a QT widget, MyWidget, and a QtDesigner plugin for MyWidget. Now I want to use MyWidget in bigger project, MyProject. I created a ui file for MyProject with QtDesigner and add a MyWidget in the designer. Now when I try to compile MyProject, I get (of course) error: can't find MyWidget.h. Is there any way to automatically pull in dependencies from qtdesigner plugins? Or would I have to manually copy MyWidget.h/cpp into the MyProject directory? One non-portable solution (it would only build on my machine with the plugin installed) would be to add QT_INSTALL_EXAMPLES/designer/MyPlugin to include_directories. However, that qmake variable QT_INSTALL_EXAMPLES does not seem to be defined in cmake. Is there anything similar? Can anyone describe a typical workflow for doing this? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] VS2010 Express generator?
I am using CMake 2.8.6 and am hoping to generate a project for VS2010 Express. Which generator should I use? I tried Visual Studio 10, but when I configure I get all kinds of errors about the compiler not working. I can try to transcribe these if necessary, but I thought there might be an easier answer first. Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] QtCreator generator?
I saw a discussion about this back in March, but I didn't see any conclusions/resolutions. Is there a way to generate a QtCreator project using CMake? I tried the CMake support that was built into QtCreator itself, but it seems very awkward (you couldn't view/set variables, etc). Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] QtCreator generator?
I think it's true that QtCreator knows how to connect to a CMake build tree generated with the CodeBlocks - Unix Makefiles generator. I tried to use this generator, but I get errors like cmake_c_compiler_env_var is undefined. Shouldn't it find the compiler for the VS2010Express installation? David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] QtCreator generator?
On Fri, Nov 11, 2011 at 12:42 PM, Alexander Neundorf a.neundorf-w...@gmx.net wrote: On Friday 11 November 2011, David Doria wrote: I think it's true that QtCreator knows how to connect to a CMake build tree generated with the CodeBlocks - Unix Makefiles generator. I tried to use this generator, but I get errors like cmake_c_compiler_env_var is undefined. Shouldn't it find the compiler for the VS2010Express installation? Please post the full output from cmake, this makes helping much easier. Sure thing - here you go: CMake Error: CMake was unable to find a build program corresponding to Unix Makefiles. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_C_COMPILER_ENV_VAR CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_C_COMPILER CMake Error: Could not find cmake module file:C:/Test/TestITK/build/CMakeFiles/CMakeCCompiler.cmake CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_CXX_COMPILER_ENV_VAR CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_CXX_COMPILER CMake Error: Could not find cmake module file:C:/Test/TestITK/build/CMakeFiles/CMakeCXXCompiler.cmake CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage Configuring incomplete, errors occurred! Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] QtCreator generator?
Ok. one more: how exactly did you run cmake ? From the command line or cmake-gui ? From the CMake-GUI. Which generator did you choose ? It should be the CodeBlocks - NMake Makefiles one. I had chosen CodeBlocks - Unix Makefiles. I just tried again with CodeBlocks - NMake Makefiles, and I get a message box that says: mspdb100.dll is missing. This then needs to be run from a terminal which has the VisualStudio environment variables set. Since I am running the GUI, I'd have to set the global Windows environment variables, right? Which variables do I need to set? Thanks for your help so far - we'll get to the bottom of this. I'll post a tutorial on the wiki once we get it working. I'd imagine this is a pretty common setup. David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] QtCreator generator?
That is the best way I have found to run CMake on Windows when multiple Visual Studios are installed. There is a Command Prompt short cut called Visual Studio Command Prompt that will have all the compiler paths setup for you. What I do is launch that command prompt then issue cmake-gui.exe from there and then CMake will know what compilers I want. Note that there are actually 2 different Visual Studio command prompts: one for 32 bit compiles (Win32) and one for the 64 bit compiles (Win64) Mike Jackson Great - that worked! It successfully generated a Code Blocks -NMake Makefile project when I ran cmake-gui from the VS2010E terminal. However, now when I open VS2010E and go to open - project, there is no .vcproj file. How do I open this project in VS2010E? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Workflow of a collaborative project in Visual Studio+CMake
I typically work in KDevelop which has CMake support, so if another developer pushes some new files and changes to the CMakeLists.txt of my project, I simply 'git pull' the project and then click Build and it knows exactly what to do - it runs CMake and then builds the project. However, when working with Visual Studio, do I have to 'git pull', then go open cmake-gui from the VS2010E terminal, re-configure and re-generate the project, then reimport the VS2010E project, then build? This seems horribly awkward. And the reverse appears to have the same problem - if working inside VS I add a file to the VS project, how do I 'export' this addition back to the git repo? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] QtCreator generator?
On Fri, Nov 11, 2011 at 5:56 PM, John Drescher dresche...@gmail.com wrote: There should have been a *.sln file that you open.? Not for a Code Blocks -NMake Makefile project. John Ok, I guess I am getting my two threads confused. *To use QtCreator* The consensus is to use the Code Blocks - NMake Generator. This has generated successfully a .cbp file (Code Block Project, I'm assuming). However, QtCreator seems unaware that this is a project and just opens it as plain text? How do I now open this project in QtCreator? *To use Visual Studio 2010 Express* If the VS PlatformSDK that David Cole mentioned is installed properly, does a Visual Studio 2010 Express generator appear in the list of generators? If not, which one am I supposed to use? Thanks, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] QtCreator generator?
*To use QtCreator* The consensus is to use the Code Blocks - NMake Generator. This has generated successfully a .cbp file (Code Block Project, I'm assuming). However, QtCreator seems unaware that this is a project and just opens it as plain text? How do I now open this project in QtCreator? Open the CMakeLists.txt and adjust the build dir to the one you created. Christian, I don't follow - the build dir should be specified in the cmake-gui, not in the CMakeLists.txt file, right? I thought by creating a project for QtCreator, we could then delete the CMakeLists.txt altogether and the project would still work? David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] FFTW_FOUND is true even if it is not found?
Using this FindFFTW.cmake: http://code.google.com/p/qmcpack/source/browse/trunk/CMake/FindFFTW.cmake?spec=svn4506r=4506 FFTW_FOUND is true even though: FFTW_INCLUDE_DIR = FFTW_INCLUDE_DIR-NOTFOUND FFTW_LIBRARIES = FFTW_LIBRARIES_NOTFOUND Can anyone explain that? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] FFTW_FOUND is true even if it is not found?
From just that module, I do not have a reasonable explanation... What does this code output, when placed: (1) directly after the find_package(FFTW) call? (2) at the very bottom of your CMakeLists.txt file...? message(STATUS FFTW_INCLUDE_DIR='${FFTW_INCLUDE_DIR}') message(STATUS FFTW_LIBRARIES='${FFTW_LIBRARIES}') message(STATUS FFTW_FOUND='${FFTW_FOUND}') message(STATUS CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}') Bah, I was not using CMake syntax for the conditional: if(NOT ${FFTW_FOUND}) vs if(!${FFTW_FOUND}) MESSAGE(FATAL_ERROR FFTW3 was not found!) endif() (shouldn't that throw an invalid syntax error? What is ! in CMake?) Is find_package(FFTW) exactly how you call it? My call is: find_package(FFTW REQUIRED) Shouldn't this produce the same error I am manually trying to produce above (since it is marked as required but not found)? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] FindITK doesn't find an installed ITK?
Hi all, If I build ITK in /home/doriad/build/ITK, and then in my .bashrc add: export ITK_DIR=/home/doriad/build/ITK when I start a new terminal and configure a project that needs ITK, it is found no problem - all is well. However, if I then install ITK (make install) to /home/doriad/bin (set with CMAKE_INSTALL_PREFIX), and add to .bashrc: export PATH=/home/doriad/bin/:$PATH export PATH=/home/doriad/bin/bin:$PATH export LD_LIBRARY_PATH=/home/ddoria/bin/lib:$LD_LIBRARY_PATH export C_INCLUDE_PATH=/home/doriad/bin/include:$C_INCLUDE_PATH export CPLUS_INCLUDE_PATH=/home/doriad/bin/include:$CPLUS_INCLUDE_PATH and then in a new terminal try again with a clean folder of the project, ITK is not found: CMake Error at Examples/CMakeLists.txt:19 (message): Cannot build without ITK. Please set ITK_DIR. I then tried setting ITK_DIR in the project's ccmake to /home/doriad/bin, but then I get this error: CMake Error at /usr/share/cmake-2.8/Modules/FindITK.cmake:90 (INCLUDE): include could not find load file: /home/doriad/bin/ITKConfig.cmake Am I missing something to have the ITK that is installed to a location on my PATH be automatically found? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Library numeric extension?
On Fri, Jun 17, 2011 at 4:30 PM, Eric Sokolowsky esok@gmail.com wrote: You didn't specify your development environment so I'm just guessing here. Under Linux, you usually have to install a development package in order to link to libraries. If you are compiling your own libgeotiff you might want to install the library before trying to link to it. You might also be linking to a library that links to the libgeotiff in question. Eric Yes it is Linux. Michael Wild was kind enough to help me through a few problems off list, but the original problem was that -L only specifies the library path to use at compile time. That is, this path is not saved in the executable, so when the executable is run, it doesn't know where to find the libraries (if they aren't on LD_LIBRARY_PATH). The fix was either to add them to LD_LIBRARY_PATH or to embed the paths into the executable via RPATH. David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Library numeric extension?
I added a simple: target_link_libraries(myprogram geotiff) to my CMakeLists.txt file. I have a libgeotiff.so in a directory on my LD_LIBRARY_PATH. The code compiled, but when I tried to run it, I got an error that I was missing libgeotiff.so.2. I made a symlink from libgeotiff.so.2 to libgeotiff.so, and then everything worked. Why was this .2 introduced? Is there either 1) a way to stop it from getting introduced or 2) a way to tell it just use the closest file so it would use the libgeotiff.so without me needing to make a symlink? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Documentation suggestion
what about Doxyen[1]? Kind regards, Benjamin What do you think Dave C? As a side-effect it would then look like other Kitware based projects (ITK, VTK etc) which all use Doxygen. David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Running two executables sequentially in a test
I am trying to run an executable that produces an output image, then compare this image to a baseline using a separate Compare executable. Is it possible to do this in a single add_test command? I tried separating the two executables with a semicolon, but that doesn't seem to work. add_executable(Compare Compare.cpp) #build the Compare executable add_executable(simple simple.cpp) #build the simple/test executable add_test(NAME SimpleTest COMMAND simple output.png;Compare output.png baselines/baseline.png) # run the 'simple' executable to produce the output, then use 'Compare' to compare it to a baseline I think doing it in two separate tests would be ok: add_test(NAME SimpleTest COMMAND simple)# run the 'simple' executable to produce the output add_test(NAME CompareSimple COMMAND Compare output.png baselines/baseline.png) # use 'Compare' to compare it to a baseline but I'm afraid that they may run in different orders (if multiple threads are used to run the tests, etc). What would be the best practice way to do this? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Running two executables sequentially in a test
On Mon, May 2, 2011 at 1:31 PM, David Cole david.c...@kitware.com wrote: If it's supposed to be one test from ctest's point of view, you should write a script that makes 2 execute_process calls, and run the script as the add_test command. I tried to write a function that runs to executables, and add that function to the test: cmake_minimum_required(VERSION 2.6) PROJECT(Test) ENABLE_TESTING() ADD_EXECUTABLE(Test1 Test1.cxx) ADD_EXECUTABLE(Test2 Test2.cxx) function(RunTest x y) execute_process(x) execute_process(y) endfunction() add_test(MyTest RunTest(Test1 Test2)) but I get the error: Unable to find executable: RunTest This must not be what you mean by a script? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Running two executables sequentially in a test
On Mon, May 2, 2011 at 1:57 PM, David Cole david.c...@kitware.com wrote: script.cmake: execute_process(x) execute_process(y) CMakeLists.txt: add_test(NAME MyTest COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/script.cmake) Or, configure the script into the build tree if you need variable values from the CMakeLists.txt file and then reference the configured copy instead. The NAME/COMMAND signature of add_test is only available in 2.8 and later, though. How are 'x' and 'y' passed to the script.cmake? (I haven't found any tutorials on .cmake files.) Or are you suggesting I have to make a separate .cmake file for each of these tests and hard code the name of the executable in each one? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Running two executables sequentially in a test
On Mon, May 2, 2011 at 2:27 PM, Tyler ty...@cryptio.net wrote: You could use -D flags (cmake -Dvar=value -P script.cmake). That seems reasonable. I tried it: CMakeLists.txt - cmake_minimum_required(VERSION 2.6) PROJECT(Test) ENABLE_TESTING() ADD_EXECUTABLE(Test1 Test1.cxx) ADD_EXECUTABLE(Test2 Test2.cxx) add_test(NAME MyTest COMMAND ${CMAKE_COMMAND} -Dcommand1=Test1 -Dcommand2=Test2 -P ${CMAKE_CURRENT_SOURCE_DIR}/script.cmake) script.cmake - execute_process(command1) execute_process(command2) but CMake fails with: execute_process given unknown argument command1. When I replace with: execute_process(${command1}) execute_process(${command2}) it still fails, but this time with: execute_process given unknown argument Test1. I thought it might not have been looking in the right path or something, so I tried: add_test(NAME MyTest COMMAND ${CMAKE_COMMAND} -Dcommand1=${CMAKE_CURRENT_BINARY_DIR}/Test1 -Dcommand2=${CMAKE_CURRENT_BINARY_DIR}/Test2 -P ${CMAKE_CURRENT_SOURCE_DIR}/script.cmake) but now it fails with: execute_process given unknown argument /home/doriad/TestCMake/bin/Test1 That executable indeed exists and runs fine. --- Also, to support previous versions I could just remove the NAME and COMMAND keywords to get: add_test(MyTest ${CMAKE_COMMAND} -Dcommand1=Test1 -Dcommand2=Test2 -P ${CMAKE_CURRENT_SOURCE_DIR}/script.cmake) right? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Documentation suggestion
On this page: http://www.cmake.org/cmake/help/cmake-2-8-docs.html there are many See XYZ statements. E.g. - else: Starts the else portion of an if block. else(expression) See the if command. - It would be very helpful if these were linked to the anchor of that command, e.g.: See the [if] command. David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] If syntax
According to this: http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:if the syntax is: if(expression) ... elseif(expression2) ... else(expression) ... endif(expression) I was recently made aware that: if(expression) ... elseif(expression2) ... else() ... endif() should also work. Should the documentation be updated to reflect this possibility? Or are they different in some way? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Dynamic linking doesn't work after install
I have created an executable like this: add_executable(ImageCompleter ${AppSources}) target_link_libraries(ImageCompleter ${LibrariesAlwaysUsed}) INSTALL( TARGETS ImageCompleter RUNTIME DESTINATION ${INSTALL_DIR} ) When I run the one that is created with 'make', it works fine. However, when I run the one that is copied by 'make install' I get: error while loading shared libraries: I get libwx_gtk2u_core-2.9.so.1: cannot open shared object file: No such file or directory It looks like this problem: http://www.cmake.org/pipermail/cmake/2010-July/038213.html but that link doesn't offer a solution. When I install it says -- Installing: /home/doriad/bin/Research/ImageCompleter -- Removed runtime path from /home/doriad/bin/Research/ImageCompleter I'm assuming that removed runtime path is the problem? How do I stop that from happening? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Dynamic linking doesn't work after install
I think the CMake page on RPATHs might be what you are looking for. http://www.cmake.org/Wiki/CMake_RPATH_handling Marcus Yea I read that, but I didn't really follow/see how to fix this problem. Surely there is a just copy the executable option? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Changing compiler
Sounds like you must have gotten errors when you built gcc... Pore through the log of what happened during the gcc build maybe? Are you building gcc from source, or using some package manager to build it for you? (MacPorts, something else?) FYI - there was no problem all along with the build (see paragraph below): The executable 'gcc' never exists in the build directory even if the build is successful. It is called 'xgcc'. 'xgcc' will finally be renamed to 'gcc' as part of 'make install'. The reason for this naming convention is listed in the source file gcc/Makefile.in: # We call this executable `xgcc' rather than `gcc' # to avoid confusion if the current directory is in the path # and CC is `gcc'. It is renamed to `gcc' when it is installed. BR, Andi However, I'm still having trouble using it to build ITK. I tried two things: 1) I run ccmake ~/src/ITK Then before I configure, I change the CMAKE_C/CXX_COMPILER variables. Then when I configure I get: You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. The following variables have changed: CMAKE_C_COMPILER= /home/doriad/bin/gcc/gcc/xgcc CMAKE_CXX_COMPILER= /home/doriad/bin/gcc/gcc/g++ CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): The C compiler /home/doriad/bin/gcc/gcc/xgcc is not able to compile a simple test program. It fails with the following output: Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp 2) I run: ccmake ../../src/ITK -DCMAKE_CXX_COMPILER=/home/doriad/bin/gcc/gcc/g++ -DCMAKE_C_COMPILER=/home/doriad/bin/gcc/gcc/xgcc CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): The C compiler /home/doriad/bin/gcc/gcc/xgcc is not able to compile a simple test program. It fails with the following output: Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp Run Build Command:/usr/bin/gmake cmTryCompileExec/fast /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build gmake[1]: Entering directory `/home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp' Any thoughts? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Changing compiler
I am trying to build ITK with a non-system-standard compiler. I did so by running: ccmake ../../src/ITK/ -DCMAKE_CXX_COMPILER=/home/doriad/src/gcc-4.5.2/bin/gcc/g++ However, I get: --- CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:45 (MESSAGE): The C++ compiler /home/doriad/src/gcc-4.5.2/bin/gcc/g++ is not able to compile a simple test program. It fails with the following output: Change Dir: /home/doriad/bin/ITK/CMakeFiles/CMakeTmp Run Build Command:/usr/bin/gmake cmTryCompileExec/fast /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build gmake[1]: Entering directory `/home/doriad/bin/ITK/CMakeFiles/CMakeTmp' --- This is indeed the correct path for the compiler: [doriad@daviddesktop ~]$ ~/src/gcc-4.5.2/bin/gcc/g++ g++: no input files I tried creating a fresh build directory and nothing changed. Any suggestions of what else to do to use this compiler? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Changing compiler
On Wed, Apr 20, 2011 at 9:04 AM, David Cole david.c...@kitware.com wrote: If you are setting the CXX compiler, you should also probably be setting the C compiler. I always use environment variables to do this: export CC=/home/doriad/src/gcc-4.5.2/bin/gcc/gcc export CXX=/home/doriad/src/gcc-4.5.2/bin/gcc/g++ ccmake ../../src/ITK If that still doesn't work, then inspect the contents of the file CMakeFiles/CMakeError.log to see what the actual errors are, and post them here. (CMakeFiles/CMakeOutput.log may also have relevant results in it...) HTH, David C. Hm, so there is no 'gcc' executable after I built gcc. Gcc's configure says: The following languages will be built: c,c++,fortran,java,objc. So I'm assuming it should be there? I tried setting the ITK C compiler to g++ as well, but no dice. In CMakeFiles/CMakeError.log of course it says: CMakeCCompilerId.c:2:3: error: #error A C++ compiler has been selected for C. The executables that were built are: [doriad@daviddesktop gcc]$ find . -executable -type f ./as ./cc1-dummy ./jcf-dump ./cc1 ./jvgenmain ./gcj ./config.status ./lto-wrapper ./cc1plus-dummy ./cc1plus ./cc1obj-dummy ./gcov ./nm ./cpp ./f951 ./xgcc ./cc1obj ./gfortran ./collect2 ./collect-ld ./jc1 ./g++ ./gcov-dump Any thoughts? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Bug fix requests for the *next* release of CMake...
CMAKE_BUILD_TYPE should be a drop down box/fixed set of choices http://public.kitware.com/Bug/view.php?id=11806 http://public.kitware.com/Bug/view.php?id=11806 David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] List of possible completion values
On Wed, Mar 30, 2011 at 11:52 AM, Tim Gallagher tim.gallag...@gatech.eduwrote: Hi, Is there a way (and if not, how do I submit a feature request) to have a set of drop-down type options in the ccmake interface? The obvious example is for CMAKE_BUILD_TYPE, where something like hitting Enter scrolls through Release - Debug - MinSizeRel, etc.. Maybe somebody has already written something to do this somewhere and I just can't find it... Thanks, Tim I have requested exactly this here: http://public.kitware.com/Bug/view.php?id=11806 http://public.kitware.com/Bug/view.php?id=11806There is a solution posted there (which I haven't tried) that may get you through for now. What I was suggesting, though, was for this to be the default behavior of CMAKE_BUILD_TYPE. David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
On Tue, Mar 29, 2011 at 1:58 AM, Michael Hertling mhertl...@online.dewrote: On 03/29/2011 07:47 AM, Michael Hertling wrote: On 03/28/2011 08:23 PM, David Doria wrote: I have setup a list of definitions: SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} UNIX;) SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} PIXEL_DIMENSION=3;) I display them and apply them to my executable as follows: add_executable(ImageCompleter ${MainSources}) message(Main build definitions: ${MAIN_BUILD_DEFINITIONS}) set_target_properties(ImageCompleter PROPERTIES COMPILE_DEFINITIONS ${MAIN_BUILD_DEFINITIONS}) The output is: Main build definitions: UNIX PIXEL_DIMENSION=3 which looks correct (i.e. UNIX was defined) However, in my code there is: #if defined(UNIX) ... some code... #else #error Not implemented for this platform! #endif When I build, the error is produced, indicating that UNIX was not defined. I created a small standalone example and it worked as expected... any suggestions of what else to check? Thanks, David AFAICS, you mess up the value of the MAIN_BUILD_DEFINITIONS list variable. Look at the following CMakeLists.txt file: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(COMPDEFS C) FILE(WRITE ${CMAKE_BINARY_DIR}/main.c int main(void){return 0;}\n) ADD_EXECUTABLE(main main.c) SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} UNIX;) LIST(LENGTH MAIN_BUILD_DEFINITIONS n) MESSAGE(MAIN_BUILD_DEFINITIONS: ${MAIN_BUILD_DEFINITIONS} -- n=${n}) SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} PIXEL_DIMENSION=3;) LIST(LENGTH MAIN_BUILD_DEFINITIONS n) MESSAGE(MAIN_BUILD_DEFINITIONS: ${MAIN_BUILD_DEFINITIONS} -- n=${n}) SET_TARGET_PROPERTIES(main PROPERTIES COMPILE_DEFINITIONS ${MAIN_BUILD_DEFINITIONS}) CMake's output contains: MAIN_BUILD_DEFINITIONS: UNIX; -- n=2 MAIN_BUILD_DEFINITIONS: UNIX; PIXEL_DIMENSION=3; -- n=3 Provided that MAIN_BUILD_DEFINITIONS is initially empty, the command SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} UNIX;) makes MAIN_BUILD_DEFINITIONS a list of *two* elements: UNIX - note the leading blank - and the empty string , and the second SET() adds PIXEL_DIMENSION=3. Probably, this is not what you intended. ;) Instead, try LIST(APPEND MAIN_BUILD_DEFINITIONS UNIX) LIST(APPEND MAIN_BUILD_DEFINITIONS PIXEL_DIMENSION=3) and CMake's output changes to MAIN_BUILD_DEFINITIONS: UNIX -- n=1 MAIN_BUILD_DEFINITIONS: UNIX;PIXEL_DIMENSION=3 -- n=2 which should work when used as COMPILE_DEFINITIONS property. IMO, the rule of thumb is: Don't use semicolons explicitly in SET() commands to assign list variables, but let CMake do this by itself. Moreover, be particularly careful when SETting list values, e.g. SET(A1 a) SET(AB1 ${A1} b) LIST(LENGTH AB1 n) MESSAGE(AB1: ${AB1} -- n=${n}) SET(A2 a a) SET(AB2 ${A2} b) LIST(LENGTH AB2 n) MESSAGE(AB2: ${AB2} -- n=${n}) results in AB1: a b -- n=1 AB2: a;a b -- n=2 i.e. AB1 is a non-list value which might by unexpected, and AB2 remains a list with just two elements which might be unexpected, too. Here, the correct coding is SET(AB1 ${A1} b) and SET(AB2 ${A2} b) which could nevertheless lead to AB{1,2} being lists of length two with an empty first element if AB{1,2} have been empty before. When adding Oops: ... if A{1,2} have been empty before., to be exact. 8-0 elements to lists it's best to use the LIST(APPEND ...) command. BTW, I can see the abovementioned CMakeLists.txt work correctly with CMake 2.8.4, so what version of CMake do you use for your project? Regards, Michael Hm, I see what you're saying regarding set() vs list(append), however I don't think that is the problem here. I tried this: list(APPEND my_definitions UNIX) list(APPEND my_definitions USE_ITK) list(APPEND my_definitions USE_FLOAT_PIXELS) list(APPEND my_definitions PIXEL_DIMENSION=1) message(my definitions: ${my_definitions}) set_target_properties(ImageCompleter1f PROPERTIES COMPILE_DEFINITIONS ${my_definitions}) (with and without quotes around ${my_definitions} in the set_target_properties line) The message command seems to be fine: my definitions: UNIX;USE_ITK;USE_FLOAT_PIXELS;PIXEL_DIMENSION=1 but the #if defined(UNIX) still fails in the code! David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
Did you do a make VERBOSE=1 to see what was being passed to the compiler? Yes, none of the definitions are being passed: http://pastebin.com/X0t0L4Jv http://pastebin.com/X0t0L4Jv David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
Can you create a standalone example of this to make it easier to debug? add_executable(foo foo.cxx) ... Bill, My standalone example works fine: http://pastebin.com/tGjX1AZ8 You can see that the UNIX and DAVID definitions are both passed. Maybe something is overriding the definitions in my real example? I see these definitions: D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -DITK_IO_FACTORY_REGISTER_MANAGER but not the ones I've set using COMPILE_DEFINITIONS David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
You might want to try running cmake --trace and see if something odd is happening when it is run. -Bill Here is the output of the trace: http://pastebin.com/MfTcNHFE It looks like the definitions list is being created and applied to the target, does it not? (see the last 10 lines of that output). What I don't see in the trace is the other definitions that I DO see in the make VERBOSE output (like -D__WXGTK__). Where would these be added? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
Most likely coming from here: /home/doriad/src/CMake/Modules/UsewxWidgets.cmake(72): SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS} ) I added: message(CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}) and the output is: CMAKE_CXX_FLAGS: -pthread -ftemplate-depth-50 -Wall -Wno-deprecated Hmm, there is also this: /home/doriad/src/CMake/Modules/UsewxWidgets.cmake(60): SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS} ) I wonder if the directory properties are causing the trouble some how. If you add a message to print out CMAKE_CXX_FLAGS you should see that stuff. That should not affect the definitions... But, the directory property might be the problem. You could try that in the small example. I added the SET_PROPERTY line to the small example: list(APPEND myvariable UNIX) list(APPEND myvariable DAVID) message(myvariable: ${myvariable}) message(CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}) SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS} ) set_target_properties(CompilerFlags PROPERTIES COMPILE_DEFINITIONS ${myvariable}) and it still works correctly (the flags are passed to the compiler in the make VERBOSE=1 output). I then added find_package(wxWidgets COMPONENTS core base REQUIRED) include( ${wxWidgets_USE_FILE} ) so that ${wxWidgets_DEFINITIONS} was actually defined and the small example still worked correctly (make VERBOSE=1 shows: /usr/lib/ccache/c++ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -DUNIX -DDAVID -pthread -g -isystem /usr/lib/wx/include/gtk2-unicode-release-2.8 -isystem /usr/include/wx-2.8-o CMakeFiles/CompilerFlags.dir/CompilerFlags.cxx.o -c /media/portable/Examples/CMake/CompilerFlags/CompilerFlags.cxx where it previously showed: /usr/lib/ccache/c++ -DUNIX -DDAVID -g -o CMakeFiles/CompilerFlags.dir/CompilerFlags.cxx.o -c /media/portable/Examples/CMake/CompilerFlags/CompilerFlags.cxx Any more suggestions? ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
An inspection of your CMakeLists.txt file [1] and the outputs of make VERBOSE=1 [2,3] reveals the following goings-on: In [2], the lines 13 and 16 generate the object files CMakeFiles/Tech.dir/src/tech/Pch.cpp.o CMakeFiles/Tech.dir/src/tech/tech/Atomic.cpp.o and obviously, these are compiled for the target Tech. The same holds for [3] in line 13 with the object file CMakeFiles/ImageCompleterLib.dir/src/image-completer-cmd/AppData.cpp.o belonging to the target ImageCompleterLib. Now, in [1], you impose the COMPILE_DEFINITIONS property on the target ImageCompleter1f only, and of course, these definitions don't appear in compilation lines for targets other than the latter. So, impose the COMPILE_DEFINITIONS property on the other targets as well, and you'll probably see them appear in the compilation lines as desired. Regards, Michael [1] http://pastebin.com/SWZgmJ33 [2] http://pastebin.com/zXaj9kWS [3] http://pastebin.com/X0t0L4Jv Ahhh it all makes sense now. I'm very sorry, I didn't realize the Tech files had been broken out into a separate static library. I was just assuming I was doing something wrong with set_target_properties etc since I had not used it before, but the problem was so obvious! Thank you all very much for your help - at least I learned some good debugging commands along the way. David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] set_target_properties not setting COMPILE_DEFINITIONS?
I have setup a list of definitions: SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} UNIX;) SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} PIXEL_DIMENSION=3;) I display them and apply them to my executable as follows: add_executable(ImageCompleter ${MainSources}) message(Main build definitions: ${MAIN_BUILD_DEFINITIONS}) set_target_properties(ImageCompleter PROPERTIES COMPILE_DEFINITIONS ${MAIN_BUILD_DEFINITIONS}) The output is: Main build definitions: UNIX PIXEL_DIMENSION=3 which looks correct (i.e. UNIX was defined) However, in my code there is: #if defined(UNIX) ... some code... #else #error Not implemented for this platform! #endif When I build, the error is produced, indicating that UNIX was not defined. I created a small standalone example and it worked as expected... any suggestions of what else to check? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
On Mon, Mar 28, 2011 at 2:28 PM, Yuri Timenkov y...@timenkov.ru wrote: Try prefixing definitions with -D I changed to: SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} -DUNIX;) SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} -DPIXEL_DIMENSION=3;) and I get: command-line: error: macro names must be identifiers I think you don't have to add -D when you set COMPILE_DEFINITIONS, but you do if you set COMPILE_FLAGS. David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
On Mon, Mar 28, 2011 at 2:31 PM, David Doria daviddo...@gmail.com wrote: On Mon, Mar 28, 2011 at 2:28 PM, Yuri Timenkov y...@timenkov.ru wrote: Try prefixing definitions with -D I changed to: SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} -DUNIX;) SET(MAIN_BUILD_DEFINITIONS ${MAIN_BUILD_DEFINITIONS} -DPIXEL_DIMENSION=3;) and I get: command-line: error: macro names must be identifiers I think you don't have to add -D when you set COMPILE_DEFINITIONS, but you do if you set COMPILE_FLAGS. David Hm, I noticed that if I do this: set(my_definitions UNIX;USE_ITK;USE_FLOAT_PIXELS;) message(my definitions: ${my_definitions}) the output is: UNIXUSE_ITKUSE_FLOAT_PIXELS but If I put spaces after the semicolons: set(my_definitions UNIX; USE_ITK; USE_FLOAT_PIXELS;) the output is: UNIX USE_ITK USE_FLOAT_PIXELS In neither case are the semicolons preserved, which seems bad because the set_target_properties call expects a semicolon separated list of preprocessor definitions. Why are these semicolons being removed? They are in a string ( ), right? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
I looked at make VERBOSE=1 as you suggested and the -D's indeed are missing. Again, in my working small demo they show up properly. I guess something else in the CMakeLists.txt must be breaking this functionality? The full file is here: http://pastebin.com/SWZgmJ33 but none of the definitions set throughout the file are used, they are all set in the set(my_definitions ... ) at the very end. (I've tried with those escaped semicolons, semicolons with spaces, and semicolons without spaces and they all have identical behavior of not defining the definitions). David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] set_target_properties not setting COMPILE_DEFINITIONS?
No, the semicolons are removed by message() itself, you'll still see them if you enclose the ${} inside the quotes: message( DEFS: ${MAIN_BUILD_DEFINITIONS} ) You're right - the output now contains the semicolons. I tried enclosing the variable in quotes in the set_target_properties line as well but the definitions are still undefined as far as the compiler is concerned. set_target_properties(ImageCompleter1f PROPERTIES COMPILE_DEFINITIONS ${my_definitions}) Here is the output of make VERBOSE=1 http://pastebin.com/zXaj9kWS You can see that none of these are defined even though: set(my_definitions UNIX;USE_ITK;USE_FLOAT_PIXELS;PIXEL_DIMENSION=1) message(my definitions: ${my_definitions}) set_target_properties(ImageCompleter1f PROPERTIES COMPILE_DEFINITIONS ${my_definitions}) displays them correctly. Thoughts? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Different CMAKE_CXX_FLAGS for different executables
Could you post the output of make VERBOSE=1? On *nix, the following CMakeLists.txt works as expected: The output of make VERBOSE=1 contains: .../c++ -DUNIX -o .../SetTargetProperties.cxx.o -c .../SetTargetProperties.cxx It is working properly now. I must not have done a 'make clean'. BTW, preprocessor definitions like -DUNIX should be set via the COMPILE_DEFINITIONS properties instead of the COMPILE_FLAGS ones. It seems to generate exactly the same thing if I use set_target_properties(CompilerFlags PROPERTIES COMPILE_FLAGS -DUNIX) and set_target_properties(CompilerFlags PROPERTIES COMPILE_DEFINITIONS UNIX) After reading the documentation you set certainly sounds like I should use the COMPILE_DEFINITIONS version, but is there a difference? Thanks again, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Different CMAKE_CXX_FLAGS for different executables
Is there a way to explicitly set the CMAKE_CXX_FLAGS for a particular executable? That is, if I set CMAKE_CXX_FLAGS and then have a add_executable line, then change CMAKE_CXX_FLAGS and then have another add_executable, will the first set of CMAKE_CXX_FLAGS be applied to the first executable and the second set of CMAKE_CXX_FLAGS be applied to the second executable? I guess my confusion is that I don't understand how CMake variables are cached. Each time I modify the variable, should I do it using SET(CMAKE_CXX_FLAGS some flags) or SET(CMAKE_CXX_FLAGS some flags CACHE STRING compiler flags) ? In this example: http://codepad.org/PGJRBjss the messages are actually not displayed at all, which is only adding to my confusion :) Any comments on this? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Different CMAKE_CXX_FLAGS for different executables
On Thu, Mar 24, 2011 at 10:44 AM, David Doria daviddo...@gmail.com wrote: Is there a way to explicitly set the CMAKE_CXX_FLAGS for a particular executable? That is, if I set CMAKE_CXX_FLAGS and then have a add_executable line, then change CMAKE_CXX_FLAGS and then have another add_executable, will the first set of CMAKE_CXX_FLAGS be applied to the first executable and the second set of CMAKE_CXX_FLAGS be applied to the second executable? I guess my confusion is that I don't understand how CMake variables are cached. Each time I modify the variable, should I do it using SET(CMAKE_CXX_FLAGS some flags) or SET(CMAKE_CXX_FLAGS some flags CACHE STRING compiler flags) ? In this example: http://codepad.org/PGJRBjss the messages are actually not displayed at all, which is only adding to my confusion :) Any comments on this? Thanks, David Scratch that last part, I was looking in the wrong place in my IDE. The output is: Using flags Using flags when I would expect: Using flags Flags1 Using flags Flags2 Can anyone explain this? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Different CMAKE_CXX_FLAGS for different executables
On Thu, Mar 24, 2011 at 11:31 AM, Yuri Timenkov y...@timenkov.ru wrote: Use COMPILE_FLAGS target property. Like this: set_target_properties(Exec2 PROPERTIES COMPILE_FLAGS /flag1 /flag2) You can see full list of properties in CMake documentation. Note that compiler flags may be also set for particular source file with set_source_files_properties command. Hi Yuri, I tried a CMakeLists.txt file like this: cmake_minimum_required(VERSION 2.6) PROJECT(SetTargetProperties) ADD_EXECUTABLE(SetTargetProperties SetTargetProperties.cxx) set_target_properties(SetTargetProperties PROPERTIES COMPILE_FLAGS -DUNIX) Then I ran: make VERBOSE=1 and I don't see anything in the output that indicates that this flag was passed, but I also don't see the call to g++ at all. How would I check that this worked correctly? Thanks for your help so far, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Concise Example of BundleUtilities for Windows
On Sat, Dec 11, 2010 at 12:23 PM, Michael Jackson mike.jack...@bluequartz.net wrote: I did find that section. what I am a bit confused about is this: ParaView includes its own version of BundleUtilities.cmake? Why? ParaView includes its own version of GetPrerequisites.cmake? Why? Is BundleUtilities aim at _just_ installing? Or will the same code run for CPack? I am trying to generate a zip archive but the normal MSVC runtime libs are missing but yet they are in my installed location on the machine? Can you rectify this difference for me? Thanks for the feedback. Mike, Please add an example in this style: http://www.vtk.org/Wiki/CMake/CPack/BundleUtilities/Examples/Linux/Automatic once you get it working. Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] CTest cannot determine repository type
When configuring ParaView (and other applications), I see this: CTest cannot determine repository type. Please set UPDATE_TYPE to 'cvs' or 'svn'. CTest update will not work. Is CTest aware of git? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] BundleUtilities
Tyler, You seem to be right in that I should not escape the $, but I DID need to add DESTINATION bin. Without it, I got a: CMake Error at CMakeLists.txt:23 (INSTALL): install FILES given no DESTINATION! This seems to work: INSTALL(FILES ${VTK_DIR}/bin/libvtkHybrid.a DESTINATION bin) The package generated is 2MB, so I'm assuming it worked? How would you test a package on a machine that DOES have the library installed and configured? David, Thanks for the history. It sounds like an excellent goal (and what I was looking for when I stumbled across it). Now we just need to ensure people know how to use it :) Now that I have a working version of the manual way ( INSTALL(FILES... ) ), I would like to convert it to the automatic way (INSTALL(CODE...) ) This is the relevant line from the Qt example: INSTALL(CODE file(GLOB_RECURSE QTPLUGINS \\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\) include(BundleUtilities) fixup_bundle(\${APPS}\ \\${QTPLUGINS}\ \${DIRS}\) COMPONENT Runtime) Can someone decode this? The reason I thought the Qt example was not very general is that this line looks like it is very Qt specific (dealing with plugins and what not). Can you explain the syntax line by line: INSTALL(CODE - start the automatic library search file(GLOB_RECURSE - look for files QTPLUGINS - what is this? \\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\) - ??? include(BundleUtilities) - Just copy and paste this every time? fixup_bundle(\${APPS}\ \\${QTPLUGINS}\ \${DIRS}\) - what is fixup_bundle? What is the APPS and DIRS variable? COMPONENT Runtime) - What is the COMPONENT? What else would it be but Runtime? Sorry for the lengthy email, but I think we should try to get this ironed out so I can make some more examples :) Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] BundleUtilities
On Wed, Nov 17, 2010 at 9:32 AM, Michael Jackson mike.jack...@bluequartz.net wrote: I tool a little different approach in my own projects. I end up configuring a shell script that gets run at install time (OS X Only). Inside that shell script are all the copying to the CMAKE_INSTALL_PREFIX, ensuring destination directories inside the OS X App bundle are setup (Plugins, libs, Frameworks) and then finally calling the BundleUtilities to copy all the dependent libraries and plugins into the App bundle and fixing the install_name embedded in each library so that they point to libraries inside the bundle. For Qt projects I also make sure a blank qt.conf file and qtmenu.nib file are properly copied into the bundle. There are some dark issues when it comes to plugins. The basic BundleUtilities will look for files that end with .dylib (on OS X) and copy those to the lib directory and frameworks into the Framework directory. The issue for me was when I had plugins with .dylib file extensions these would always be copied into the wrong directory. I had to make sure I used a set properties to set the file extension of my own plugins to .plugin so I had a guaranteed way to tell the difference between a support library that should go into lib and a plugin that should get copied into Plugins. One form of this can be found at http://scm.bluequartz.net/support-libraries/cmp/blobs/master/OSX_Tools/CompleteBundle.cmake.in There may be some Qt specific lines in the file and it is OS X specific. Also note that you can over-ride some of the BundleUtilities commands in order to implement variations that suit your own needs. ___ Mike Jackson www.bluequartz.net David C. - Is what Mike is doing here a work around or is this how BundleUtilities is intended to be used? I was *hoping* for something more along the lines of simply: INSTALL(Qt) INSTALL(VTK) Those two lines would include everything necessary from Qt and VTK in your project so you can hand someone without those tools your code and it will run. Is this the goal and it is just not that easy (yet)? Or I am missing something? David D. ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] BundleUtilities
BundleUtilities is meant to be a more general approach to packaging 3rd party libraries. It will look at an executable, and find all of its dependencies (the ones necessary to make the program execute) and copy the non-system dependencies into your install directory. Clint, Great, this is even better than INSTALL(VTK) INSTALL(Qt) You make it sound like it should be even less code: INSTALL(EVERYTHING) But I don't see anything like this. Is there a way to convert my: INSTALL(FILES ${VTK_DIR}/bin/libvtkHybrid.a DESTINATION bin) into: INSTALL(EVERYTHING_NECESSARY) ? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] BundleUtilities
The goal is simply this: - given: -- an executable target, that happens to be a bundle app on the Mac -- a full path to that bundle in the install tree -- a list of plugins that you have also already installed in the bundle -- a list of directories where to find libraries that your executables and plugins depend on that the following CMake code: install(CODE include(BundleUtilities) fixup_bundle(\${YOUR_BUNDLE_PATH}\ \\${YOUR_PLUGINS}\ \${YOUR_LIBRARY_DIRS}\) COMPONENT Runtime) will do all the analysis and copying and fixing up of dependent libraries that is mechanically possible... So that you do not even have to mention VTK and Qt to your install rules at all. If you have to say anything about VTK or Qt beyond target_link_libraries, then BundleUtilities is a failure. David C. Ok, progress, and more questions: 1) I think it worked, check it out.: http://www.vtk.org/Wiki/CMake/CPack/BundleUtilities/Examples/Linux/Automatic Though the .deb created is 37MB, where when I manually included vtkHybrid.a it was only 2MB... 2) Do I need both the INSTALL(TARGETS... and INSTALL(CODE... ? Could these be combined into one command? It seems like there is a lot of duplication (I am specifying the executable twice, etc). 3) Is there a way to lose all the $,\, and in the syntax? That is, change: fixup_bundle(\${APPS}\ \\${YOUR_PLUGINS}\ \${YOUR_LIBRARY_DIRS}\) to: fixup_bundle(${APPS} ${YOUR_PLUGINS} ${YOUR_LIBRARY_DIRS}) That would make it seem much easier to use, even if it really isn't any easier :) http://www.vtk.org/Wiki/CMake/CPack/BundleUtilities/Examples/Linux/Automatic4) I'm still not sure what is going on with this business: BUNDLE DESTINATION . COMPONENT Runtime RUNTIME DESTINATION bin COMPONENT Runtime I think a definition of a bundle a destination, a component and runtime should be provided here: http://www.itk.org/Wiki/BundleUtilitiesExample 5) Why do you have to specify the Library_Dirs? Can't it just use the same list that it uses to look for vtkHybrid when I specify it in the target_link_libraries: TARGET_LINK_LIBRARIES(VTKIncludeTest vtkHybrid) David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CPack general question and example
Great, it's working. The only thing that was required was: SET(CPACK_DEBIAN_PACKAGE_MAINTAINER David Doria) Here is the working example: http://www.cmake.org/Wiki/CMake/CPack/Examples/Linux/DEB The page you sent (http://www.vtk.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29) has a lot of variables marked mandatory, but they all seem to have reasonable defaults except the MAINTAINER. Could this terminology be modified? Also, (I think) there are some typos that I don't feel confident correcting myself: if CPACK_DEBIAN_PACKAGE_VERSION is not set CPACK_PACKAGE_VERSION - If CPACK_DEBIAN_PACKAGE_VERSION is not set, it will default to CPACK_PACKAGE_VERSION if CPACK_DEBIAN_PACKAGE_NAME is not set, CPACK_PACKAGE_NAME (lower case) will be used I strongly suggest that we create http://www.cmake.org/Wiki/CMake/CPack/Examples/Linux/RPM http://www.cmake.org/Wiki/CMake/CPack/Examples/Linux/TAR http://www.cmake.org/Wiki/CMake/CPack/Examples/Windows/EXE (or whatever it is called) etc. so that it is very clear (one can copy/paste a solution) how to do this. Thanks for the help! David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] BundleUtilities
Hi all, I found the Qt example here: http://www.itk.org/Wiki/BundleUtilitiesExample http://www.itk.org/Wiki/images/2/25/QtTest-Package-Example.zip The two INSTALL commands seem fairly complicated - is there not a way to do all of that in the project-to-be-included's cmake configuration so that a command like INSTALL(Qt) could do the job? I think Qt may be a complicated place to start (all of the MOC/etc stuff seems to be an extra 30 lines distracting from the point of the BundleUtilities). Does anyone have an example that will bundle VTK with their executable? This seems like it should be easier, and equally as consumed by people around this wiki/list :) Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Compiling header files
I am trying to use ADD_LIBRARY to create a .lib file from a collection of .cpp and .h files. If I do: ADD_LIBRARY(LibraryName AllOfTheCPPFiles.cpp) and then try to link against that library, I get many missing-function type linker errors. I looked in the .h files and many of them have actual function definitions: (an example): class UdpTransmitSocket : public UdpSocket{ public: UdpTransmitSocket( const IpEndpointName remoteEndpoint ) { Connect( remoteEndpoint ); } }; I tried to tell CMake to compile the .h files into the library as well by doing this: set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS} h) ADD_LIBRARY(LibraryName AllOfTheCPPFiles.cpp AllOfTheHFiles.h) but it didn't seem to change anything. Is there a way this is typically handled? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] BundleUtilities
On Tue, Nov 16, 2010 at 1:35 PM, Michael Jackson mike.jack...@bluequartz.net wrote: I think we used Qt as a basis because lots of people at the time were asking for it. Probably the simplest to demonstrate would be an example that builds a dynamic library and an executable that uses that library so therefor it must be packaged with the executable. Were you wanting to write the example or wondering if someone else has one? ___ Mike Jackson www.bluequartz.net I was wondering if someone else has one :) / encouraging it to be produced if it does not already exist. Unfortunately I can't dig into the code to write it myself. I think your suggestion of the VERY simplest case is a great one. If we had that as well as how to do it with another big library (VTK), this would hopefully be a much more usable tool. I think these would be good homes for them: http://cmake.org/Wiki/CMake/Examples/BundleUtilities/Simple http://cmake.org/Wiki/CMake/Examples/BundleUtilities/VTK http://cmake.org/Wiki/CMake/Examples/BundleUtilities/Qt David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Compiling header files
Ryan, The issue is that these headers are only used internally to this collection of files, so I don't want to have to include them in my code. Here is a skeleton: The files I've been given -- External.h External.cpp Internal.h (used by External) Internal.cpp My files MyCode.cpp So I wanted to ADD_LIBRARY(TheLibrary External.cpp Internal.cpp) Then ADD_EXECUTABLE(MyCode MyCode.cpp) target_link_libraries(MyCode TheLibrary) where MyCode.cpp has only an #include External.h See what I mean? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Compiling header files
Hm, it works correctly in Linux, but I still get a bunch of error LNK2019: unresolved external symbol errors in Windows. The only difference I see is that the .lib file gets created in a subdirectory of bin/ bin/Debug/OSC.lib (or bin/Release/OSC.lib) vs the .a file which gets created in bin directly: bin/OSC.a Does something have to be done differently because of this? I guessed no, because I thought it would have complained that it couldn't find the OSC library rather than just produce linker errors. Here is the CMakeLists.txt file: cmake_minimum_required(VERSION 2.6) PROJECT(TestOSC) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) IF(WIN32) set(SystemTypePath ip/win32) ELSE(WIN32) set(SystemTypePath ip/posix) ENDIF(WIN32) ADD_LIBRARY(OSC ip/IpEndpointName.cpp ${SystemTypePath}/NetworkingUtils.cpp ${SystemTypePath}/UdpSocket.cpp osc/OscPrintReceivedElements.cpp osc/OscReceivedElements.cpp osc/OscTypes.cpp osc/OscOutboundPacketStream.cpp ) ADD_EXECUTABLE(SimpleReceive examples/SimpleReceive.cpp) TARGET_LINK_LIBRARIES(SimpleReceive OSC) Everything look ok? Any thoughts? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Compiling header files
Also use VS IDE to make sure the library is listed. The library is indeed listed in Additional Dependencies of the linker for the executable target. What symbols? Try running dumpbin /symbols OSC.lib. I figured it out - I had to link to winmm to get the symbol: symbol __imp__timeGetTime and Ws2_32 to get several symbols like: symbol __imp__ht...@4 I have never developed in Windows - I didn't know I needed to link to additional libraries sometimes. Now I know. Thanks for all of the pointers! David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] BundleUtilities
Is the goal simply to copy ...VTK/bin/libvtkHybrid.a into the package? I tried this: INSTALL(CODE \${VTK_DIR}/bin/libvtkHybrid.a) But I get: Parse error. Expected a command name, got unquoted argument with text ${VTK_DIR}/bin/libvtkHybrid.a. I made a home for this here: http://www.vtk.org/Wiki/CMake/CPack/BundleUtilities/Examples/Linux/VTK if anyone has a better suggestion. David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] CPack general question and example
I just heard about CPack and started playing with it. I tried to make an RPM of a simple VTK program: http://www.cmake.org/Wiki/CMake/CPackExample When I run 'make package', I get an error: CPack Error: Problem copying the package: /home/doriad/CPackTest/bin/_CPack_Packages/Linux/RPM/DistanceBetweenPoints-0.1.1-Linux.rpm to /home/doriad/CPackTest/bin/DistanceBetweenPoints-0.1.1-Linux.rpm CPack Error: Error when generating package: DistanceBetweenPoints make: *** [package] Error 1 If I leave out the SET(CPACK_GENERATOR RPM) line, there are no errors, but the .tar.gz file that is created seems to be empty. Am I missing something? On a bigger question - what can I expect to be contained in the RPM? EVERYTHING required to run my program (which will include all of VTK (or at least the required bits?))? I'm just trying to get a handle on when and why I would want to do this. Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CPack general question and example
You need INSTALL commands for everything you want to be in the package For your example: ADD_EXECUTABLE(DistanceBetweenPoints DistanceBetweenPoints.cxx) INSTALL(TARGETS DistanceBetweenPoints DESTINATION bin) # Add this for CPack to work Then both make install and make package will work , and there will be bin directory in the package with DistanceBetweenPoints executable in it. Vladislav Thanks for the quick replies. After adding the INSTALL command, 'make install' works as expected. 'make package' created an rpm. When I ran rpm -ihv file.rpm it told me to use alien to convert it to a .deb (Ubuntu 10.03). Instead, I changed the cpack generator to DEB. When I then ran 'make package', I got some errors: dor...@davidlaptop:~/CPackTest/bin$ make package [100%] Built target DistanceBetweenPoints Run CPack packaging tool... CPack: Create package using DEB CPack: Install projects CPack: - Run preinstall target for: DistanceBetweenPoints CPack: - Install project: DistanceBetweenPoints CPack: Compress package CMake Error at /usr/share/cmake-2.8/Modules/CPackDeb.cmake:119 (MESSAGE): Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER CPack Error: Problem running tar command: /usr/bin/cmake -E tar cfz control.tar.gz ./control ./md5sums Please check /home/doriad/CPackTest/bin/_CPack_Packages/Linux/DEB/Deb.log for errors CPack Error: Problem compressing the directory CPack Error: Error when generating package: DistanceBetweenPoints make: *** [package] Error 1 I am using: dor...@davidlaptop:~/CPackTest/bin$ cmake --version cmake version 2.8.1 Also, I see that there is an example of BundleUtilities to bundle Qt. I will take a look at that tomorrow. Is the same possible for VTK? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Auto re-configuring until cache stops changing
OK... good. I was just clarifying for the readers of the thread why we will not be auto-configuring-for-multiple-iterations... Ever. :-) Ok, so is the voting over? There didn't seem to be much participation (as expected...). Where does it go from here? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Auto re-configuring until cache stops changing
On Fri, Sep 10, 2010 at 10:25 AM, David Cole david.c...@kitware.com wrote: I think we're too close to the first release candidate of CMake 2.8.3 to be adding features at this point. But this is a great candidate for an early change immediately after the 2.8.3 release. If we get it into 'next' immediately after the upcoming release, then all the kinks (there will be one or two, nearly guaranteed) should be worked out and have it ready for the 2.8.4 release a few months down the road. How does that sound? Thanks for the conversation, David C. Sounds great to me. Thanks for the predicted schedule. Should I put it on the bug tracker so it is noticed when looking through features to add? David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Auto re-configuring until cache stops changing
On Mon, Sep 6, 2010 at 9:18 AM, David Cole david.c...@kitware.com wrote: The Generate button should be enabled after the first configure. It's not enabled because the prevailing theory of the day was that you shouldn't allow generate unless there were *no* *new* cache entries after the most recent configure... -- force users to pay attention to those new red entries -- in other words, it's just history and reluctance to change behavior that's always been that way... I've always thought that you should be allowed to generate whenever you want to: I'd go so far as to say that Generate should be enabled as soon as you open cmake-gui, and that, if there have not been *any* configure steps, it would do the same thing as command line cmake: configure once and generate, all in one click. Please reply with more feedback: How many of you would: - keep the current behavior exactly as is, it's good - enable Generate unconditionally - something in between Thanks, David David C., I fear all of the votes for enable generate unconditionally will never be cast because the users that really want/need it are not on the CMake mailing list. I'd like to cast 32 votes by proxy in favor of the unconditional generate button! Thanks, David D. ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Windows 64 bit version?
I don't see a 64 bit Windows binary here: http://www.cmake.org/cmake/resources/software.html Is the link missing? Or does this not exist for some reason? Thanks, David ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake