[CMake] cmake 2.6 : Issue in renaming the cmake executable on Linux
Hi, I've a Ubuntu 8.04.1 Linux machine and cmake version 2.4-patch 7 in /usr/bin/ Due to project requirement, I installed cmake version 2.6-patch 4 under /usr/local/ I want to make sure that when I or other users execute cmake, by default it's always the 2.4 version in /usr/bin/cmake irrespective of PATH env var settings. Those who want to invoke cmake version 2.6 should explicitly use the full path. To ensure this I renamed the cmake 2.6 executable under /usr/local/bin/cmake to /usr/local/bin/cmake-2.6 But this renaming is causing problems as follows. r...@linux:/usr/local/bin# ./cmake-2.6 --version CMake Error: CMake executable cannot be found at /usr/local/bin/cmake Segmentation fault mla...@linux:~/bld] /usr/local/bin/cmake-2.6 .. CMake Error: CMake executable cannot be found at /usr/local/bin/cmake CMake Error: Error executing cmake::LoadCache(). Aborting. I did the renaming so that plain 'cmake' always refers to version 2.4 under /usr/bin irrespective of PATH setting. What could be the reason for choosing above behaviour by cmake implementors ? Thank you, Mahendra The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/___ 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] cmake 2.6 : Issue in renaming the cmake executable on Linux
On 8. Jan, 2010, at 9:54 , Mahendra Ladhe wrote: Hi, I've a Ubuntu 8.04.1 Linux machine and cmake version 2.4-patch 7 in /usr/bin/ Due to project requirement, I installed cmake version 2.6-patch 4 under /usr/local/ I want to make sure that when I or other users execute cmake, by default it's always the 2.4 version in /usr/bin/cmake irrespective of PATH env var settings. Those who want to invoke cmake version 2.6 should explicitly use the full path. To ensure this I renamed the cmake 2.6 executable under /usr/local/bin/cmake to /usr/local/bin/cmake-2.6 But this renaming is causing problems as follows. r...@linux:/usr/local/bin# ./cmake-2.6 --version CMake Error: CMake executable cannot be found at /usr/local/bin/cmake Segmentation fault mla...@linux:~/bld] /usr/local/bin/cmake-2.6 .. CMake Error: CMake executable cannot be found at /usr/local/bin/cmake CMake Error: Error executing cmake::LoadCache(). Aborting. I did the renaming so that plain 'cmake' always refers to version 2.4 under /usr/bin irrespective of PATH setting. What could be the reason for choosing above behaviour by cmake implementors ? Thank you, Mahendra Well, that's because the name cmake is hard-coded in cmake.cxx. If you really want to force users to use the full path, you shouldn't put it in /usr/local/bin anyways. I suggest you put it in e.g. /opt/software/cmake-2.6.4 without any renaming. You might also want to have a look into http://modules.sf.net in order to manage heterogeneous environments, where you have multiple versions of the same software installed and want to make them available to the user with as little fuzz as possible. If you set it up correctly, a user can just type module add cmake/2.6 and the environment will be set up to use this installation instead of the default one... Michael ___ 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] intercomponent link dependencies?
On Thu, 7 Jan 2010 19:24:19 -0600, Ryan Pavlik rpav...@iastate.edu wrote: So then actually should we all be doing imported targets in our find modules then? Many/most Find* modules don't work with static libraries. Jed ___ 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] intercomponent link dependencies?
Hi Nico, I think you should put the knowledge of the intercomponent link dependencies in your FindXXX script. That way, you don't have to bother the user of this third-party package with this knowledge. BTW, if you're on Linux and your package contains shared libraries, instead of static libraries, then, iff the package was properly built (i.e. with the dependencies linked into the shared libs) you won't need to specify these indirect dependencies. Best regards, Marcel Loose. On Thu, 2010-01-07 at 21:20 +0100, Nico Schlömer wrote: Hi Ryan, thanks very much for your answer. For clarification, the package I would like to link against has (say) three components A, B, C, where A at link time needs symbols of B needs symbols of C needs symbols of some external libs. I would like to make sure that the user can say FIND_PACKAGE( mypackage COMPONENTS A ) and then find in some variable *all* the dependencies that are required for linking, e.g., MYPACKAGE_A_LIBRARY=a;b;c;/usr/local/lib/libblas.a. Right now (and which I'm not happy with), if a user would like to link against liba.a, he or she has to know that libb.a, libc.a, and /usr/local/lib/libblas.a have to be pulled in as well, and do so manually. If on the other hand I have the same dependency situation with libraries that I *built*, the TARGET_LINK_LIBRARIES mechanism works very well. If I understand correctly, this cannot be applied to components in a FINDmypackage.cmake Cheers, Nico On Thu, Jan 7, 2010 at 8:43 PM, Ryan Pavlik rpav...@iastate.edu wrote: Hello, My apologies in advance if I'm completely mis-reading your question and if this answer seems way off base: just addressing what seemed like the most likely issue from the info you provided. (This link below [1] might help you get better results out of mailing lists.) A script called by find_package(whatever) only normally sets variables in CMake - it doesn't include or link any targets against any libraries. (You might have several targets in one CMake project, each that link against different libraries) So, in addition to the find_package(Mypackage), in your CMakeLists.txt, you'll also want to do, for example: include_directories(${MYPACKAGE_INCLUDE_DIRS}) add_executable(myapp ${MYAPP_SOURCES}) target_link_libraries(myapp ${MYPACKAGE_FOOCOMP_LIBRARY} ${MYPACKAGE_BARCOMP_LIBRARY}) Note that according to the readme.txt in the modules directory of cmake (and what seems to be convention), you'll note that your find module variables should probably be named as above ( PACKAGEUPPER_COMPONENTUPPER_LIBRARY ). Additionally, once you've run find_package_handle_standard_args, if(PACKAGEUPPER_FOUND), you will probably want to do the following - this example assumes you have some main library for the package that's always needed to link against that package, and some additional optional libraries specified as components (openscenegraph is an example of one of these types of packages) set(PACKAGEUPPER_LIBRARIES ${PACKAGEUPPER_LIBRARY}) foreach(COMPONENT ${list_of_requested_and_found_components}) list(APPEND PACKAGEUPPER_LIBRARIES ${PACKAGEUPPER_COMPONENT_LIBRARY}) endforeach() I've attached a rather simple example of this kind of script - you'd of course have your component search loop and the additional foreach loop explained above added to this basic structure. (and if you're doing it by creating imported targets, you'll obviously use that code instead of the direct file path code) Hope this helps! Ryan [1] http://catb.org/~esr/faqs/smart-questions.html On 01/07/2010 09:19 AM, Nico Schlömer wrote: Hi Michael, I added to the FindMypackage.cmake in the FOREACH(COMPONENT) loop the following snipped ADD_LIBRARY(${COMPONENT} STATIC IMPORTED) SET_TARGET_PROPERTIES( ${COMPONENT} PROPERTIES IMPORTED_LOCATION ${${UPPERCOMPONENT}_LIBRARY} LINK_INTERFACE_LIBRARIES ${${COMPONENT}_LINK_INTERFACE_LIBRARIES} ) where ${${UPPERCOMPONENT}_LIBRARY} is the path of the respective library in the filesystem, and ${${COMPONENT}_LINK_INTERFACE_LIBRARIES} a semicolon-separated list of dependencies of ${COMPONENT} (being either another component, or something of the form /path/to/libfancy.a). CMake does create all the Makefiles -- good -- but the dependency information doesn't sit in there (?). I expected that I can go like FIND_PACKAGE( Mypackage COMPONENTS foocomp barcomp ) and that all the necessary stuff would be included automatically. -- Well, now that I think about it this is probably a pipe dream. What would I further have to include? Cheers, Nico On Thu, Jan 7, 2010 at 12:47 PM, Michael Wildthem...@gmail.com wrote: Hi Nico In that case you need to do this: add_library(${COMPONENT} IMPORTED)
Re: [CMake] intercomponent link dependencies?
On 8. Jan, 2010, at 10:20 , Marcel Loose wrote: Hi Nico, I think you should put the knowledge of the intercomponent link dependencies in your FindXXX script. That way, you don't have to bother the user of this third-party package with this knowledge. BTW, if you're on Linux and your package contains shared libraries, instead of static libraries, then, iff the package was properly built (i.e. with the dependencies linked into the shared libs) you won't need to specify these indirect dependencies. Best regards, Marcel Loose. Again, this is very difficult to do. Depending on HOW the static library was built (i.e. which optional parts have been enabled) the transitive link dependencies change. E.g. if you have libcurl.a you need to find out whether that thing has been compiled against OpenSSL, GnuTLS or Mozilla NSS or no SSL implementation at all. Good luck with that... And then on Windows you currently can't determine whether that .lib file is a link-library (i.e. used to link against a .dll) or actually a static library. And if you just throw them in for good measure, you run into over-linking issues: http://wiki.mandriva.com/en/Overlinking Static linking is and will always be a mess (unless all projects install a CMake-file containing the appropriate add_library(XXX IMPORTED) and IMPORTED_LINK_INTERFACE_LIBRARIES stanzas, or CMake learns to use libtool .la files and all projects create them and write them correctly). Just my 2c. Michael ___ 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] intercomponent link dependencies?
Hi, BTW, if you're on Linux and your package contains shared libraries, instead of static libraries, then, iff the package was properly built (i.e. with the dependencies linked into the shared libs) you won't need to specify these indirect dependencies. Yeah well, they're all static from a to z. :) --Nico ___ 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] intercomponent link dependencies?
Hi, I am guessing that you're putting the detection for every library that your app can/must use into one find module, when you actually probably should have a directory in your source tree added to your CMAKE_MODULE_PATH that contains a large number of find modules, some of which are interdependent (just like how the example I sent uses find_package(BLAS) - which is a module that comes bundled with cmake). -- Exactly! I'm thinking now that this is indeed a good solution: Writing *separate* FindLibraryX.cmake files for all the libraries included in MyPackage and putting all the dependency information in there; then, make a meta .cmake file which will allow for specifying the keyword COMPONENTS, and where all the meta information goes (e.g., version number of MyPackage). Minor drawbacks of this approach I find would be that the fact that all those libraries live under one roof is entirely discarded, that is, that they all share a common LIB directory, INCLUDE directory, all have the same version string (namely the one of MyPackage). Plus also, new libraries included require their own new FindNewLib.cmake to be created, while all FindLibrary*.cmake would actually be the same file, except for the dependency info (nasty (?) code duplication). How I came to think about COMPONENTS in the first place was looking at FindBoost.cmake which I *thought does what I'm doing -- except for the intercomponent linking info. Cheers! Nico ___ 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] Overriding CMAKE_C_FLAGS on a per-directory basis
Hi, is it possible to override CMAKE_C_FLAGS on a per-directory basis? I have attempted to solve this by setting CMAKE_C_FLAGS to a different value than the default used in the project, but this modification is not reflected in the command line for compilation within the directory. Example global CMAKE_C_FLAGS are -foo -bar some_dir/CMakeLists.txt: [...] set(CMAKE_C_FLAGS -argl) [...] Still sources in some_dir are compiled with -foo -bar rather than with -argl. Also setting the COMPILE_FLAGS property via set_source_files_properties() applied to the sources in some_dir would only *append* the new flags to -foo -bar rather than replacing them. cmake 2.8 on Linux. Kind regards Ingolf ___ 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] Overriding CMAKE_C_FLAGS on a per-directory basis
Hi Ingolf, If you've set the flags -foo -bar using add_definitions(), instead of manipulating CMAKE_C_FLAGS directly, you can use set_directory_properties(PROPERTIES COMPILE_DEFINITIONS -baz) to override the compile definitions for the current directory and its subdirectories. Hope this helps, Marcel Loose. On Fri, 2010-01-08 at 12:26 +0100, Ingolf Steinbach wrote: Hi, is it possible to override CMAKE_C_FLAGS on a per-directory basis? I have attempted to solve this by setting CMAKE_C_FLAGS to a different value than the default used in the project, but this modification is not reflected in the command line for compilation within the directory. Example global CMAKE_C_FLAGS are -foo -bar some_dir/CMakeLists.txt: [...] set(CMAKE_C_FLAGS -argl) [...] Still sources in some_dir are compiled with -foo -bar rather than with -argl. Also setting the COMPILE_FLAGS property via set_source_files_properties() applied to the sources in some_dir would only *append* the new flags to -foo -bar rather than replacing them. cmake 2.8 on Linux. Kind regards Ingolf ___ 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 ___ 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 while stage install of crosscompiled binaries
On Fri, Jan 8, 2010 at 12:37 AM, Claus Klein claus.kl...@arcormail.dewrote: On 08.01.2010, at 02:25, Alexander Neundorf wrote: On Thursday 07 January 2010, Claus Klein wrote: Hi i want to install a cross compiled (build host is a MAC OS X) project to a temporary state dir to get an archive to distribute the binaries. The target is win32 (mingw), compiled to be installed at c:/usr as CMAKE_INSTALL_PREFIX. This prefix is used while compile the binaries, so I can't change it. I think, that when I use DESTDIR while make DESTDIR=/tmp/cmake install, the device (C:) should be removed before to use it as part of a path like this: STRING(REGEX REPLACE [A-Za-z:/] CMAKE_INSTALL_PREFIX $ {CMAKE_INSTALL_PREFIX}) head cmake_install.cmake # Install script for directory: /Users/clausklein/Workspace/c/libsmi/ trunk # # Set the install prefix IF(NOT DEFINED CMAKE_INSTALL_PREFIX) SET(CMAKE_INSTALL_PREFIX C:/usr) ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) STRING(REGEX REPLACE /$ CMAKE_INSTALL_PREFIX $ {CMAKE_INSTALL_PREFIX}) . . . . As you can see, PREFIX is appended to DESDIR without modification. which is wrong in this special case. Yes. So you would suggest to remove the drive letter from CMAKE_INSTALL_PREFIX when installing with DESTDIR set ? Alex Yes I think it is never a valid path in this case to on Windows itself: i.e. C:/tmp/cmake/C:/usr/lib/pkgconfig I want to create a zip archive at /tmp/cmake to install it on Windows under C:/ Claus ___ 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 Can you try setting CMAKE_INSTALL_PREFIX to just /usr instead of C:/usr to see if you can get what you want in that manner...? ___ 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] FindCUDA with ITK
On Thu, Jan 7, 2010 at 8:52 PM, Luke Parkinson lparkin...@vpac.org wrote: - James Bigler jamesbig...@gmail.com wrote: On Wed, Jan 6, 2010 at 11:00 PM, Luke Parkinson lparkin...@vpac.orgwrote: Hello Everyone, I apologise in advance if this is the wrong way to revive an old topic, but I wasn't sure how to reply to old threads in the mailing list and I'm new to this list. I'm part of a team of developers looking at integrating CUDA into the Insight Toolkit (http://www.itk.org/). People subscribing to the mailing list over there might have heard from my colleague. Thanks to James Bigler and his FindCUDA.cmake module, we have been able to get CUDA and ITK to link into the executable, but we're having a similar problem to the previous post (included below just in case). I have created several 'build environments' using this module with my own modifications that include the SDK (as an aside, can anyone point me in the direction of code that integrates C++ and CUDA without using cutil.h or cutil_inline.h?). It works brilliantly with just the CUDA SDK, and the SDK plus our own C++ CUDA utility programs, but when we include the ITK in the configuration, building gives errors exactly like those above. I've attached my modifications to the FindCUDA.cmake module (with a diff), and the 'CMakeLists.txt's we're using in the root and source directories. We got the original FindCUDA.cmake from the svn repository, and based our code on the driver examples. When we add our own CUDA/C++ code (files omitted as code is still under development, permission is required), we get the same errors as mentioned previously, along the lines of 'warning: comparison between signed and unsigned integer expressions'. Just including ITK (without our own code, using the provided driver code examples) [Attached the corresponding files as ITKOnly_FindCUDA.cmake, ITKOnly_root_CMakeLists.txt, ITKOnly_src_CMakeLists.txt] Any ideas or suggestions would be helpful. This isn't crippling (only warnings), but it is annoying and could lead to problems later on if it has to do with how the CMake module deals with C/C++ code. I also noticed with that same module that there are a few variables that don't seem to do anything. The example I found was CUDA_INCLUDE_DIRECTORIES (deprecated by CUDA_INCLUDE_DIRS?). I assume that svn version was the most up-to-date, please let me know if I am wrong. snip... What versions of CUDA are you using? 2.3 or a 3.0 beta? Also, could you send the output of 'make VERBOSE=1' with CUDA_NVCC_FLAGS=-v for a single object compilation that has these warning? I would like to determine at which point these flags are causing problems. You could also attach (if possible) the cmake build script that is invoked by FindCUDA for the same object? Also, please make sure that CUDA_HOST_COMPILATION_CPP is ON (this can also be verified by me with the cuda_compilecmake file you can attach). There is also the CUDA_PROPAGATE_HOST_FLAGS that you could turn off, if you wish to manage all the host flag propagation manually by using the OPTION -Xcompiler combination. James The CMake build script is identicle to the others I posted, just different source files and executable names. I included it anyway though, in case there was something I missed. I also double-checked the CUDA_HOST_COMPILATION flag, it's definitely set to 1. If you still think it would help, where can I find cuda_compile.cmake? I've attached the complete 'make VERBOSE=1' for both the FindCUDA.cmake sample code, and one with some of the warnings we've been getting for our own code. The CMakeCache.txt is from the ITK build I'm using, so you can see some of the variables it had defined internally. If you've seen the CMakeLists.txt I sent yesterday, it includes an ITK file USE_ITK_FILE (it's just in the recommendded build, points to the attached UseITK.cmake), which is where the new compile flags are introduced. Thanks for the tip about the CUDA_PROPAGATE_HOST_FLAGS and OPTION -Xcompiler, I'll try it out if all else fails. And thanks for the quick reply and you help with this, Luke Thanks. If it's possible, I need the output after adding the -v argument to the CUDA_NVCC_FLAGS. This will show all the compilation steps from nvcc and then we can see what commands nvcc is passing to the compiler as well as what source files its using. Also, does it produce the warning when you don't specify -Wall? You may be able to suppress this flag with a -Wno-all for CUDA code. The cuda_compile.cmake file I talked about is part of the build system. Each CUDA file generates its own compilation script which is then invoked by the build system. The one for test_bin.cu in the svn test system should be found here: build/src/CMakeFiles/cuda_compile_generated_test_bin.cu.obj.cmake This file contains all the parameters (well most of them) that are used to compile
Re: [CMake] CUDA, CMAKE, and an attempt to build nbody
On Thu, Jan 7, 2010 at 5:08 PM, Brian Davis bitmi...@gmail.com wrote: From FindCuda (with cmake now in my build tree so I can patch it): # Search in the CUDA_BIN_PATH first. find_path(CUDA_TOOLKIT_ROOT_DIR NAMES nvcc nvcc.exe PATHS ENV CUDA_BIN_PATH DOC Toolkit location. NO_DEFAULT_PATH ) # Now search default paths find_path(CUDA_TOOLKIT_ROOT_DIR NAMES nvcc nvcc.exe PATHS /usr/local/bin /usr/local/cuda/bin DOC Toolkit location. ) I think the reason that the find_path(CUDA_TOOLKIT_ROOT_DIR doesn't work with the paths supplied by find_package is that your paths don't include the bin directory, and thus misses the executable. I'll have to look into that more, but for now you should just specify the locations with CUDA_TOOLKIT_ROOT_DIR (as per the documentation in FindCUDA.cmake). I gave this a try: #set( CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_DIR} CACHE STRING FORCE ) #set( CUDA_SDK_ROOT_DIR ${NVIDIA_SDK_DIR} CACHE STRING FORCE ) find_package( cuda PATHS ${CUDA_TOOLKIT_DIR} ${NVIDIA_SDK_DIR} C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/bin C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2/bin NO_DEFAULT_PATH) and it did not work. I can get it to work by commenting out the set's above. Sure that didn't work, because the find_path command was looking for nvcc in ${CUDA_TOOLKIT_DIR} instead of looking for bin/nvcc in ${CUDA_TOOLKIT_DIR}. I suspect if you changed find_package to use ${CUDA_TOOLKIT_DIR/bin it might work, though for 64 bit builds it would have to be ${CUDA_TOOLKIT_DIR}/bin64. I'll see if I can experiment with this a bit more and figure out what is the right solution to make both of these scenarios work. Following the advice from http://www.cmake.org/cmake/help/cmake-2-8-docs.html: The default search order is designed to be most-specific to least-specific for common use cases. Projects may override the order by simply calling the command multiple times and using the NO_* options: find_package(package PATHS paths... NO_DEFAULT_PATH) find_package(package) This is urrr... umm... hokey (calling multiple times). And I cannot seem to get it to work. I use this construct, because CMake will favor default paths before supplied paths, and I want to make sure that the stuff in my path is found first. This is an general internal CMake construct which is not FindCUDA specific yes/no? Yes, this is how CMake works. The documentation for the find_XYZ functions explains the search order, and subsequent emails to mailing list helped me settle determine that this construct is the only way to obtain the needed functionality. Perhaps CMake could be augmented with a USE_SUPPLIED_PATHS_FIRST argument to change the search ordering to help avoid having to run the command twice. James ___ 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 tests as part of a build
I am seriously looking at moving the build system of some existing software from scons to cmake. Most things I want to accomplish seem easier in cmake, but there is one thing I can't work out how to do. I like to have (at least some) unit test run as part of the build, e.g. when I type 'make' then my program compiles, the tests compile and then the tests run. This means that failing tests are equivalent to a failing build, and stops me 'forgetting' to run 'make test'. I can generate my tests and and have them added to the 'test' target easily enough, and 'make test' works fine. Is there a straightforward way to run tests after they are built as part of 'make' on its own, and have a failing test cause a build failure? I'm using g++ on linux mac and Google Test as my unit testing framework, in case it make a difference to the answer. Thanks very much, Gavin ___ 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 tests as part of a build
On Friday 08 January 2010 11:10:23 am Gavin Heavyside wrote: I am seriously looking at moving the build system of some existing software from scons to cmake. Most things I want to accomplish seem easier in cmake, but there is one thing I can't work out how to do. I like to have (at least some) unit test run as part of the build, e.g. when I type 'make' then my program compiles, the tests compile and then the tests run. This means that failing tests are equivalent to a failing build, and stops me 'forgetting' to run 'make test'. I can generate my tests and and have them added to the 'test' target easily enough, and 'make test' works fine. Is there a straightforward way to run tests after they are built as part of 'make' on its own, and have a failing test cause a build failure? I'm using g++ on linux mac and Google Test as my unit testing framework, in case it make a difference to the answer. Have you looked at add_custom_command(TARGET ...) or add_custom_target(...)? Those are how you run can run commands as part of the build, but after some other targets are compiled. Clint ___ 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 tests as part of a build
Have you looked at add_custom_command(TARGET ...) or add_custom_target(...)? Those are how you run can run commands as part of the build, but after some other targets are compiled. Clint That works great, thanks for the tip! I build my code, and then my test programs using add_executable. Then I can do e.g.: add_custom_command(TARGET test_harness POST_BUILD COMMAND test_harness) and test_harness runs after building, with proper dependencies, and a failing test causes a failing build. Perfect. Anything I don't want to run by default I can leave to add_test on its own. Thanks very much, Gavin ___ 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 while stage install of crosscompiled binaries
Hi David, Yes, this works fine when I change the CMAKE_INSTALL_PREFIX at CMakeCache.txt, sure. There is only one fault: the config files will be rebuild with the wrong path before install :-(( At least, I know 2 packages, NetSnmp and LibSmi, they has to be compiled with fix absolute paths, including the device name on Windows, that is not my idea! It would be better to use a ConfigFile and the program can be install at any place. But they is a history and they needs there MIB's. (What is the current drive to find this config file when I start c:/ usr/bin/smilint from d:/workdir?) When I add the string replace command to the cmake_install.cmake file, it works as a quick hack. This should only remove the drive string in the middle, not the beginning of the PREFIX path: STRING(REGEX REPLACE /[A-Za-z]:/ / CMAKE_INSTALL_PREFIX $ {CMAKE_INSTALL_PREFIX}) But I know that this can't be the general solution. I did not see any DESTDIR in this file, so I think it will be set as parameter or in environment? Only if DESTDIR is given, this drive name has to be replace. Where is the DESTDIR prepended to the PREFIX? Is there a template for this generated cmake_install.cmake? Claus On 08.01.2010, at 17:49, David Cole wrote: On Fri, Jan 8, 2010 at 12:37 AM, Claus Klein claus.kl...@arcormail.de wrote: On 08.01.2010, at 02:25, Alexander Neundorf wrote: On Thursday 07 January 2010, Claus Klein wrote: Hi i want to install a cross compiled (build host is a MAC OS X) project to a temporary state dir to get an archive to distribute the binaries. The target is win32 (mingw), compiled to be installed at c:/usr as CMAKE_INSTALL_PREFIX. This prefix is used while compile the binaries, so I can't change it. I think, that when I use DESTDIR while make DESTDIR=/tmp/cmake install, the device (C:) should be removed before to use it as part of a path like this: STRING(REGEX REPLACE [A-Za-z:/] CMAKE_INSTALL_PREFIX $ {CMAKE_INSTALL_PREFIX}) head cmake_install.cmake # Install script for directory: /Users/clausklein/Workspace/c/libsmi/ trunk # # Set the install prefix IF(NOT DEFINED CMAKE_INSTALL_PREFIX) SET(CMAKE_INSTALL_PREFIX C:/usr) ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX) STRING(REGEX REPLACE /$ CMAKE_INSTALL_PREFIX $ {CMAKE_INSTALL_PREFIX}) . . . . As you can see, PREFIX is appended to DESDIR without modification. which is wrong in this special case. Yes. So you would suggest to remove the drive letter from CMAKE_INSTALL_PREFIX when installing with DESTDIR set ? Alex Yes I think it is never a valid path in this case to on Windows itself: i.e. C:/tmp/cmake/C:/usr/lib/pkgconfig I want to create a zip archive at /tmp/cmake to install it on Windows under C:/ Claus ___ 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 Can you try setting CMAKE_INSTALL_PREFIX to just /usr instead of C:/usr to see if you can get what you want in that manner...? ___ 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] Qt qmake not found
I am trying to use: FIND_PACKAGE(Qt4 REQUIRED) However, I get: CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:1625 (MESSAGE): Qt qmake not found! I am using Fedora 11. I did yum install qt* qmake* but nothing changed. Any suggestions? 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] Qt qmake not found
On Fri, Jan 08, 2010 at 09:30:14PM -0500, David Doria wrote: I am trying to use: FIND_PACKAGE(Qt4 REQUIRED) However, I get: CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:1625 (MESSAGE): Qt qmake not found! I am using Fedora 11. I did yum install qt* qmake* but nothing changed. Any suggestions? You probably need to insure that qmake is in your PATH. If you just installed it maybe you need to login again so you resource your shell init files? tyler ___ 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] Qt qmake not found
On Fri, Jan 8, 2010 at 9:50 PM, Tyler Roscoe ty...@cryptio.net wrote: On Fri, Jan 08, 2010 at 09:30:14PM -0500, David Doria wrote: I am trying to use: FIND_PACKAGE(Qt4 REQUIRED) However, I get: CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:1625 (MESSAGE): Qt qmake not found! I am using Fedora 11. I did yum install qt* qmake* but nothing changed. Any suggestions? You probably need to insure that qmake is in your PATH. If you just installed it maybe you need to login again so you resource your shell init files? tyler Hmm.. I restarted my shell and the error has changed to: Qt libraries, includes, moc, uic or/and rcc NOT found! qmake is now on my path: [dor...@davedesktop BarChart]$ which qmake /usr/lib/qt-3.3/bin/qmake Any new 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] Qt qmake not found
David Doria wrote: On Fri, Jan 8, 2010 at 9:50 PM, Tyler Roscoe ty...@cryptio.net wrote: On Fri, Jan 08, 2010 at 09:30:14PM -0500, David Doria wrote: I am trying to use: FIND_PACKAGE(Qt4 REQUIRED) However, I get: CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:1625 (MESSAGE): Qt qmake not found! I am using Fedora 11. I did yum install qt* qmake* but nothing changed. Any suggestions? You probably need to insure that qmake is in your PATH. If you just installed it maybe you need to login again so you resource your shell init files? tyler Hmm.. I restarted my shell and the error has changed to: Qt libraries, includes, moc, uic or/and rcc NOT found! qmake is now on my path: [dor...@davedesktop BarChart]$ which qmake /usr/lib/qt-3.3/bin/qmake That is Qt 3, and you are looking for Qt4. -Bill ___ 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] Qt qmake not found
You installed qt version 3 instead of qt version 4. Sudo apt-get install qt4-dev. Or something like that. Mike Sent from my iPod On Jan 8, 2010, at 21:59, David Doria daviddo...@gmail.com wrote: On Fri, Jan 8, 2010 at 9:50 PM, Tyler Roscoe ty...@cryptio.net wrote: On Fri, Jan 08, 2010 at 09:30:14PM -0500, David Doria wrote: I am trying to use: FIND_PACKAGE(Qt4 REQUIRED) However, I get: CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:1625 (MESSAGE): Qt qmake not found! I am using Fedora 11. I did yum install qt* qmake* but nothing changed. Any suggestions? You probably need to insure that qmake is in your PATH. If you just installed it maybe you need to login again so you resource your shell init files? tyler Hmm.. I restarted my shell and the error has changed to: Qt libraries, includes, moc, uic or/and rcc NOT found! qmake is now on my path: [dor...@davedesktop BarChart]$ which qmake /usr/lib/qt-3.3/bin/qmake Any new 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 ___ 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] Qt qmake not found
On Fri, Jan 8, 2010 at 10:07 PM, Mike Jackson mike.jack...@bluequartz.net wrote: You installed qt version 3 instead of qt version 4. Sudo apt-get install qt4-dev. Or something like that. Mike Sent from my iPod On Jan 8, 2010, at 21:59, David Doria daviddo...@gmail.com wrote: On Fri, Jan 8, 2010 at 9:50 PM, Tyler Roscoe ty...@cryptio.net wrote: On Fri, Jan 08, 2010 at 09:30:14PM -0500, David Doria wrote: I am trying to use: FIND_PACKAGE(Qt4 REQUIRED) However, I get: CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:1625 (MESSAGE): Qt qmake not found! I am using Fedora 11. I did yum install qt* qmake* but nothing changed. Any suggestions? You probably need to insure that qmake is in your PATH. If you just installed it maybe you need to login again so you resource your shell init files? tyler Hmm.. I restarted my shell and the error has changed to: Qt libraries, includes, moc, uic or/and rcc NOT found! qmake is now on my path: [dor...@davedesktop BarChart]$ which qmake /usr/lib/qt-3.3/bin/qmake Any new 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 Ah, yep, qt3 was on my path before qt4. Thanks all, 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] Qt qmake not found
On Fri, Jan 8, 2010 at 10:10 PM, David Doria daviddo...@gmail.com wrote: On Fri, Jan 8, 2010 at 10:07 PM, Mike Jackson mike.jack...@bluequartz.net wrote: You installed qt version 3 instead of qt version 4. Sudo apt-get install qt4-dev. Or something like that. Mike Sent from my iPod On Jan 8, 2010, at 21:59, David Doria daviddo...@gmail.com wrote: On Fri, Jan 8, 2010 at 9:50 PM, Tyler Roscoe ty...@cryptio.net wrote: On Fri, Jan 08, 2010 at 09:30:14PM -0500, David Doria wrote: I am trying to use: FIND_PACKAGE(Qt4 REQUIRED) However, I get: CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:1625 (MESSAGE): Qt qmake not found! I am using Fedora 11. I did yum install qt* qmake* but nothing changed. Any suggestions? You probably need to insure that qmake is in your PATH. If you just installed it maybe you need to login again so you resource your shell init files? tyler Hmm.. I restarted my shell and the error has changed to: Qt libraries, includes, moc, uic or/and rcc NOT found! qmake is now on my path: [dor...@davedesktop BarChart]$ which qmake /usr/lib/qt-3.3/bin/qmake Any new 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 Ah, yep, qt3 was on my path before qt4. Thanks all, David One last thing (hopefully). What's the trick to making it find: QT_PHONON_INCLUDE_DIR automatically? I set it to /usr/include/phonon and it works - but why wouldn't cmake find 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