Re: [CMake] telling find_package exactly where to find a package
On Fri, Jan 30, 2009 at 7:11 AM, Philip Lowman phi...@yhbt.com wrote: On Fri, Jan 30, 2009 at 12:08 AM, Tyler Roscoe ty...@cryptio.net wrote: I'll spend some more time reading FindQt4.cmake at work tomorrow, but I wanted to post this while I'm thinking about it. I would like to tell find_package where my third-party libraries are (Qt specifically). Since I know where the libraries are, I could manually add paths to INCLUDE_DIRS and LINK_LIBRARIES, but FindQt4 already knows how to do all of that so why duplicate the effort? This is for an internal build system, so I want to use a specific version of Qt installed on a networked filesystem to prevent any weirdness caused by a developer compiling against some random Qt that she might have on her dev machine. This seems like a common situation, so surely there's a CMake way to handle it? I was hoping the PATHS parameter would do what I want but it's for specifying the path to the FindXXX modules. Read the documentation for the find_path() and find_library() commands. Setting the variable CMAKE_PREFIX_PATH (or environment variable) will likely be of tremendous help to you. I have a project with similar requirements as Tyler's, and we effectively use the CMAKE_PREFIX_PATH variable. The thing is that if you ONLY want the FindXXX.cmake to look in the paths pointed by CMAKE_PREFIX_PATH, and not the standard ones (e.g., /usr, /usr/local, ... on Unix), this might not be enough. FindBoost.cmake has a very convenient variable named Boost_ROOT that specifies where the boost libraries are located. Taking a quick look at the FindQt*.cmake doc, I didn't find a similar functionality, but I still wonder if it can be achieved in a simple way. A side-comment that is tangentially related to the subject: all of our custom-made FindXXX.cmake files use the HINTS property of find_path(...) and find_library(...) (CMake = 2.6). HTH, Adolfo Rodríguez Tsouroukdissian -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Generating test executables with make test
Hi all, I have a project with a suit of test executables that I create with CMake by means of add_executable(fooTest ${foo_DEPENDENCIES}), and then register in CTest with add_test(fooTest fooTest), and everything works just fine. As a next step, I wanted to exclude the building of the tests from the all target and associate them to the test target. Naively, I tried to EXCLUDE_FROM_ALL the test executables, and add_dependency(fooTest test), but I realized that this is not possible, since test (and install, clean, etc.) are not primary targets, and are only exist in the generated Makefiles. After reading various threads in this list, Section 10.5 of Mastering CMake (Using CTest to Drive Complex Tasks), and a couple of examples from the CMake source code, I tried something like: add_test(fooTest ${CMAKE_CTEST_COMMAND} --build-and-test ${CMAKE_CURRENT_SOURCE_DIR}/test ${CMAKE_CURRENT_BINARY_DIR}/test --build-two-config --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_BUILD_TOOL} --build-project common --test-command fooTest) where the CMakeLists.txt file located in ${CMAKE_CURRENT_SOURCE_DIR}/test creates the test executable. Correct me if I'm wrong, but this CMakeLists.txt file needs to be a standalone CMake project that needs to bring into scope all the required external dependencies, and set up the necessary variables, which were all defined with the previous setup (using add_test(fooTest fooTest)). Since I'm working on a somewhat big project, performing this setup is quite inconvenient. Am I doing something wrong here? am I missing something? or must I pay the price of setting up a project for each test executable? Thanks in advance, Adolfo Rodríguez Tsouroukdissian P.S., I would like to express my support for the feature request reported in http://public.kitware.com/Bug/view.php?id=8438 although I know that asking for this is easier said than done. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] how to build library for this..
Thanks for all the help its working. Regards- ankit jain 2009/1/30 Philip Lowman phi...@yhbt.com On Thu, Jan 29, 2009 at 11:38 PM, ankit jain ankitgu...@gmail.comwrote: 2009/1/29 Pau Garcia i Quiles pgqui...@elpauer.org On Thu, Jan 29, 2009 at 1:12 PM, ankit jain ankitgu...@gmail.com wrote: hi all, Problem: libA : A/foo.cc libB : B/bar.cc and a 3rd library: libC : A/foo.cc B/bar.cc ? here i build the libraries for A and B but not able to build lib for C . Guide me to do that. What should be the content of cmakelist file of C to create lib C here A and B are sub folders of C Do you ean you are trying this but it's not working? ADD_LIBRARY (libA A/foo.cc ) ADD_LIBRARY (libB B/bar.cc ) ADD_LIBRARY (libC libA libB ) That fails because CMake does not support convenience libraries: http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F You need to do this: ADD_LIBRARY (libA A/foo.cc ) ADD_LIBRARY (libB B/bar.cc ) ADD_LIBRARY (libC A/foo.cc B/bar.cc ) I. e. list the source files for libC Is that what you want to do? Dont you think so it will be too hectic if there are 10 folders inside folder C and each folder has around 10 C files each. then listing all will be really cumbersome. What should be the alternative for it. Here's one idea, in A and B set a variable with all of the source files and add them to the PARENT_SCOPE. set(A_SRCS a.cc) set(A_SRCS ${A_SRCS} PARENT_SCOPE) add_library(A ${A_SRCS}) Then in the higher directory, use a foreach() loop to construct a proper relative path to each source file: foreach(fname ${A_SRCS}) list(APPEND C_SRCS A/${fname}) endforeach() foreach(fname ${B_SRCS}) list(APPEND C_SRCS B/${fname}) endforeach() add_library(both ${C_SRCS}) -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] telling find_package exactly where to find a package
On Fri, Jan 30, 2009 at 3:44 AM, Adolfo Rodríguez dof...@gmail.com wrote: On Fri, Jan 30, 2009 at 7:11 AM, Philip Lowman phi...@yhbt.com wrote: On Fri, Jan 30, 2009 at 12:08 AM, Tyler Roscoe ty...@cryptio.net wrote: This seems like a common situation, so surely there's a CMake way to handle it? I was hoping the PATHS parameter would do what I want but it's for specifying the path to the FindXXX modules. Read the documentation for the find_path() and find_library() commands. Setting the variable CMAKE_PREFIX_PATH (or environment variable) will likely be of tremendous help to you. I have a project with similar requirements as Tyler's, and we effectively use the CMAKE_PREFIX_PATH variable. The thing is that if you ONLY want the FindXXX.cmake to look in the paths pointed by CMAKE_PREFIX_PATH, and not the standard ones (e.g., /usr, /usr/local, ... on Unix), this might not be enough. FindBoost.cmake has a very convenient variable named Boost_ROOT that specifies where the boost libraries are located. Taking a quick look at the FindQt*.cmake doc, I didn't find a similar functionality, but I still wonder if it can be achieved in a simple way. Sorry to disappoint, but FindBoost suffers from the same issue in that setting Boost_ROOT doesn't guarantee you won't have libraries picked up in the system paths. http://public.kitware.com/Bug/view.php?id=8412 Worse case, if you absolutely can't stand finding stuff outside of X_ROOT perhaps you can obtain the path of X_LIBRARY with GET_FILENAME_COMPONENT() and ensure it's within X_ROOT through a regex or something, after you call FIND_PACKAGE()? I am considering such an approach with FindBoost to warn about detection of a Boost library in a system path when the Boost include dir is in Boost_ROOT. -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] telling find_package exactly where to find a package
Hmmm, nice to know that. I currently do not perform any kind of sanity check on the include/lib paths, although I print an informative message to the user. Thanks for the tip! Adolfo Rodríguez Tsouroukdissian On Fri, Jan 30, 2009 at 10:49 AM, Philip Lowman phi...@yhbt.com wrote: On Fri, Jan 30, 2009 at 3:44 AM, Adolfo Rodríguez dof...@gmail.comwrote: On Fri, Jan 30, 2009 at 7:11 AM, Philip Lowman phi...@yhbt.com wrote: On Fri, Jan 30, 2009 at 12:08 AM, Tyler Roscoe ty...@cryptio.netwrote: This seems like a common situation, so surely there's a CMake way to handle it? I was hoping the PATHS parameter would do what I want but it's for specifying the path to the FindXXX modules. Read the documentation for the find_path() and find_library() commands. Setting the variable CMAKE_PREFIX_PATH (or environment variable) will likely be of tremendous help to you. I have a project with similar requirements as Tyler's, and we effectively use the CMAKE_PREFIX_PATH variable. The thing is that if you ONLY want the FindXXX.cmake to look in the paths pointed by CMAKE_PREFIX_PATH, and not the standard ones (e.g., /usr, /usr/local, ... on Unix), this might not be enough. FindBoost.cmake has a very convenient variable named Boost_ROOT that specifies where the boost libraries are located. Taking a quick look at the FindQt*.cmake doc, I didn't find a similar functionality, but I still wonder if it can be achieved in a simple way. Sorry to disappoint, but FindBoost suffers from the same issue in that setting Boost_ROOT doesn't guarantee you won't have libraries picked up in the system paths. http://public.kitware.com/Bug/view.php?id=8412 Worse case, if you absolutely can't stand finding stuff outside of X_ROOT perhaps you can obtain the path of X_LIBRARY with GET_FILENAME_COMPONENT() and ensure it's within X_ROOT through a regex or something, after you call FIND_PACKAGE()? I am considering such an approach with FindBoost to warn about detection of a Boost library in a system path when the Boost include dir is in Boost_ROOT. -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding install dependency to test-target?
If I do this: LIST(APPEND extra_libopts_clean_files ./libopts/.libs/libopts.o ./libopts/.libs/libopts.la ./libopts/.libs ./libopts/_libs ./libopts/libopts.la ./libopts/so_locations ./libopts/*.o ./libopts/*.lo ) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${extra_libopts_clean_files}) I get an error about too many args to SET_DIRECTORY_PROPERTIES. Try using quotes: SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${extra_libopts_clean_files} ) And If I specify each file individually, it appears that only the last takes effect (basically subsequent calls overwrite the previous value). Surely there is a way to specify multiple files right? In such a case, you could use the APPEND functionality in set_property: http://www.cmake.org/cmake/help/ctest2.6docs.html#command:set_property SET_PROPERTY( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIRECTORY} APPEND ADDITIONAL_MAKE_CLEAN_FILES ./libopts/.libs/libopts.la ) But beware of this issue when using ADDITIONAL_MAKE_CLEAN_FILES http://public.kitware.com/Bug/view.php?id=8164 -- if there is no *target* present in the CMakeLists.txt, then the directory does not count as a directory in the cmake sense, so the directory property will be ignored. Honestly, both of these solutions are just hacks it seems like cmake really should have a way to add to the 'clean' and 'install' pseudo-targets. I agree. This issue is apparently known though, so be patient, see Brad Kings comment: http://public.kitware.com/Bug/view.php?id=8438 -- thanks Brad! Best regards Hugo Heden ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to set Windows DLL version information
Philip Lowman schrieb: Do you know if there is a way to append this information to the DLL with the linker (FileVersion ProductVersion), instead of generating an RC file? No. HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] cpack -G DEB for subdirectories
Hello I seem not able to find an example of how to generate .deb files with cpack for different subdirectories of a project. Is this possible and if so, how? ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] find_package(Qt4): EXACT doesn't work
On 29.01.09 16:27:10, Tyler Roscoe wrote: Hey cmakers, I think I've found a bug: Not really :) [tyle...@alta:~/tmp/build]$ cat ../CMakeLists.txt cmake_minimum_required(VERSION 2.6) find_package(Qt4 9 EXACT REQUIRED) message(qt4_found is ${QT4_FOUND}) message(qt_use_file is ${QT_USE_FILE}) The reason this doesn't work is that FindQt4 simply hasn't been changed to work with the new cmake2.6 feature of specifying the version in the find_package call. Hence it only supports setting a cmake variable QT_MIN_VERISON before running find_package. This also doesn't support an exact match, its just a minimum required. Of course you may file an enhancement report to make FindQt4.cmake care for the cmake-variables set when using the version argument for find_package. Andreas -- Are you making all this up as you go along? ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
I have created an out-of-source build tree (on Windows), with the installation directory as a subfolder of the build trees. The idea is that the compiled binary requires some DLL's, images, 3D models and configuration files, at a location relative to the executable. If the files are changed, they will be copied from the source tree to the installation tree again. Therefore, I need to run make install all before running the executable. Because of the executable's dependency on the other files, I always want to build and install. (I don't expect a built file to work in itself because it won't be able to find the required files) In such a situation I usually try to configure_file things into the build tree such that I can run the executable from the build tree. Also setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH for this purpose is very useful. If I need to configure some files differently for the build and install tree, I configure them twice into separate directories (the latter e.g. under ${CMAKE_BINARY_DIR}/InstallFiles). This way I can have different versions of the configured files for the build and install tree. I have now set up the tree so that the executables can be run immediately from where they are created. I use configure_file to copy the files. The problem is now, that every time I do a re-configure, the files (including a dll that is very big) are copied. Is there a way of making sure the files are copied *only* when they are renewed? (and also making sure they are removed when the original is removed?) Here is my layout of the project: My setup is as follows: Src //the root of the cmake project +- Bin | Main.cxx + Lib | All other cxx and h files I made +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Debug //all contents over here is generated by cmake-gui ../src and make +- Bin | Main.exe | DLLs of 3rd party library +- Lib | Compiled libXXX.a files +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Thirdparty //this directory provides the 3rd party libraries we link | // against or include +- Cxxtest +- OgreSDK +- Bin | +- Debug | | All the DLL's | +- Release | All the DLL's +- Lib Include - This e-mail is intended exclusively for the addressee. If you are not the addressee you must not read, copy, use or disclose the e-mail nor the content; please notify us immediately [by clicking 'Reply'] and delete this e-mail. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] how to specify path of header files at run time through cmake
hi all, How can we specify the path of header fiels at run time through cmake since i have a line in my C file as #include %h Regards- ankit jain ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] cpack -G DEB for subdirectories
2009/1/30 BlinkEye gen...@blinkeye.ch: Hello I seem not able to find an example of how to generate .deb files with cpack for different subdirectories of a project. Is this possible and if so, how? As far as I know CPack only handles a single per-project package, i.e. you may easilly build a package (deb, rpm, tgz etc...) for the WHOLE project, even if the project does have subdirectories. CPack will package all target, files etc... which are INSTALL(TARGET ... INSTALL(FILES ... etc... There is a possibility to use the COMPONENT feature: http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack, in order to build different package using different CMake build options but as far as I know DEB generator does not currently handle COMPONENT: http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack#Ideas_for_Future_Development So if you want a single deb package you may add whatever needed INSTALL command in every subdirectory you want and it should work. If you want several deb I would say you either need to split your project in several projects or submit a patch for the DEB generator :-) -- Erk ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
I use the following to copy some test files from one directory to another: SET (HDF5_REFERENCE_TEST_FILES tnullspace.h5 family_v1.7_3.h5 family_v1.7_1.h5 mergemsg.h5 tbogus.h5 tbad_msg_count.h5 group_new.h5 deflate.h5 noencoder.h5 family_v1.7_0.h5 le_extlink1.h5 tmtimeo.h5 tmtimen.h5 fill_old.h5 tlayouto.h5 family_v1.7_2.h5 th5s.h5 tarrold.h5 ) FOREACH ( h5_file ${HDF5_REFERENCE_TEST_FILES} ) SET (dest ${PROJECT_BINARY_DIR}/${h5_file}) MESSAGE(STATUS Copying ${dest}) ADD_CUSTOM_COMMAND ( TARGET ${HDF5_TEST_LIB_NAME} POST_BUILD COMMAND${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TEST_DIR}/${h5_file} $ {dest} ) ENDFOREACH ( h5_file ${HDF5_REFERENCE_TEST_FILES} ) Unfortunately it runs every time cmake is run but is still pretty quick since after the first time it doesn't really copy anything. _ Mike Jackson mike.jack...@bluequartz.net BlueQuartz Softwarewww.bluequartz.net Principal Software Engineer Dayton, Ohio On Jan 30, 2009, at 8:00 AM, Jonatan Bijl wrote: I have created an out-of-source build tree (on Windows), with the installation directory as a subfolder of the build trees. The idea is that the compiled binary requires some DLL's, images, 3D models and configuration files, at a location relative to the executable. If the files are changed, they will be copied from the source tree to the installation tree again. Therefore, I need to run make install all before running the executable. Because of the executable's dependency on the other files, I always want to build and install. (I don't expect a built file to work in itself because it won't be able to find the required files) In such a situation I usually try to configure_file things into the build tree such that I can run the executable from the build tree. Also setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH for this purpose is very useful. If I need to configure some files differently for the build and install tree, I configure them twice into separate directories (the latter e.g. under ${CMAKE_BINARY_DIR}/InstallFiles). This way I can have different versions of the configured files for the build and install tree. I have now set up the tree so that the executables can be run immediately from where they are created. I use configure_file to copy the files. The problem is now, that every time I do a re-configure, the files (including a dll that is very big) are copied. Is there a way of making sure the files are copied *only* when they are renewed? (and also making sure they are removed when the original is removed?) Here is my layout of the project: My setup is as follows: Src //the root of the cmake project +- Bin | Main.cxx + Lib | All other cxx and h files I made +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Debug //all contents over here is generated by cmake-gui ../src and make +- Bin | Main.exe | DLLs of 3rd party library +- Lib | Compiled libXXX.a files +- Data | Required files (3d models, images, etc.) +- Cfg Required config files Thirdparty //this directory provides the 3rd party libraries we link | // against or include +- Cxxtest +- OgreSDK +- Bin | +- Debug | | All the DLL's | +- Release | All the DLL's +- Lib Include - This e-mail is intended exclusively for the addressee. If you are not the addressee you must not read, copy, use or disclose the e-mail nor the content; please notify us immediately [by clicking 'Reply'] and delete this e-mail. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
2009/1/30 Jonatan Bijl jonatan.b...@tba.nl: I have now set up the tree so that the executables can be run immediately from where they are created. I use configure_file to copy the files. The problem is now, that every time I do a re-configure, the files (including a dll that is very big) are copied. Is there a way of making sure the files are copied *only* when they are renewed? I thought configure_file would only copy the file if it has changed [ not that you should use COPYONLY configure_file(InputFile OutputFile COPYONLY) ] however if it is not the case you may replace your configure_file with EXECUTE_PROCESS(${CMAKE_COMMAND} -E copy_if_different InputFile OutputFile) (and also making sure they are removed when the original is removed?) don't really know how to do that -- Erk ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] cpack -G DEB for subdirectories
On Fri, January 30, 2009 14:37, Eric Noulard wrote: As far as I know CPack only handles a single per-project package, i.e. you may easilly build a package (deb, rpm, tgz etc...) for the WHOLE project, even if the project does have subdirectories. CPack will package all target, files etc... which are Thanks for elaborating and answering my question. I'm actually trying to generate different .deb files for a single project (e.g. for different libraries, executables). Checking out your links it looks like this is not possible at the moment. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Using Eclipse CDT, CMake resets Eclipse project configuration frequently
Thanks! FYI, I've created some macros to do the copying. Haven't thoroughly tested them yet, but they appear to be working. MACRO(COPY_FILE_IF_CHANGED in_file out_file target) ADD_CUSTOM_COMMAND ( TARGET ${target} POST_BUILD COMMAND${CMAKE_COMMAND} ARGS -E copy_if_different ${in_file} ${out_file} ) message(copying: ${in_file} to ${out_file}) ENDMACRO(COPY_FILE_IF_CHANGED) MACRO(COPY_FILE_INTO_DIRECTORY_IF_CHANGED in_file out_dir target) GET_FILENAME_COMPONENT(file_name ${in_file} NAME) COPY_FILE_IF_CHANGED(${in_file} ${out_dir}/${file_name} ${target}) ENDMACRO(COPY_FILE_INTO_DIRECTORY_IF_CHANGED) MACRO(COPY_DIRECTORY_IF_CHANGED in_dir out_dir target) FILE(GLOB_RECURSE copy_files ${in_dir}/*) FOREACH(in_file ${copy_files}) STRING(REGEX REPLACE ${in_dir} ${out_dir} out_file ${in_file}) COPY_FILE_IF_CHANGED(${in_file} ${out_file} ${target}) ENDFOREACH(in_file) ENDMACRO(COPY_DIRECTORY_IF_CHANGED) Jonatan - This e-mail is intended exclusively for the addressee. If you are not the addressee you must not read, copy, use or disclose the e-mail nor the content; please notify us immediately [by clicking 'Reply'] and delete this e-mail. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] INSTALL TARGET with no target to compile
On Thursday 29 January 2009, Alexander Neundorf wrote: On Thursday 29 January 2009, Daniele E. Domenichelli wrote: I have a small template library in c++ composed by .h files only and I want to use cmake to configure, find dependencies and install the library (compiling is not needed). This template library is in a bigger package with some other libraries that I install using INSTALL TARGET signature. I know I could use INSTALL FILES, but I would like to use the same syntax (INSTALL TARGET) for the first library, so I tried creating a new target, but with no results... Is there a way to do it? No. If you just have to install a set of files, use install(FILES). If you didn't create a target using add_executable() or add_library(), you can't use install(TARGETS) Do you have some specific problem with install(FILES ) ? Hi, Thanks for the answer. No, I don't have any specific problem with install(FILES), my problem was just because I'm installing all the other sublibrary of my project using install(TARGETS) and I was guessing if I could use the same syntax for all of them for easier maintenance... Regards, Daniele ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] how to specify path of header files at run time through cmake
What do you mean %h? Is this a literal character in your file? If so, then at least I've never heard of it. You specify paths to header files using the include_directories command: $ cmake --help-command include_directories cmake version 2.6-patch 1 -- SingleItem include_directories Add include directories to the build. include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...) Add the given directories to those searched by the compiler for include files. By default the directories are appended onto the current list of directories. This default behavior can be changed by setting CMAKE_include_directories_BEFORE to ON. By using BEFORE or AFTER you can select between appending and prepending, independent from the default. If the SYSTEM option is given the compiler will be told that the directories are meant as system include directories on some platforms. James On Fri, Jan 30, 2009 at 6:24 AM, ankit jain ankitgu...@gmail.com wrote: hi all, How can we specify the path of header fiels at run time through cmake since i have a line in my C file as #include %h Regards- ankit jain ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] cpack -G DEB for subdirectories
On Fri, Jan 30, 2009 at 5:11 PM, BlinkEye gen...@blinkeye.ch wrote: On Fri, January 30, 2009 14:37, Eric Noulard wrote: As far as I know CPack only handles a single per-project package, i.e. you may easilly build a package (deb, rpm, tgz etc...) for the WHOLE project, even if the project does have subdirectories. CPack will package all target, files etc... which are Thanks for elaborating and answering my question. I'm actually trying to generate different .deb files for a single project (e.g. for different libraries, executables). Checking out your links it looks like this is not possible at the moment. You may want to use custom CPack scripts for different purposes. By default, CPack uses script generated by CMake in top-level directory, but you can write your own one (and as many as you want) and pass it to cpack as command line parameter. Of course, install components could be great help in packaging. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Adding install dependency to test-target?
On Fri, Jan 30, 2009 at 3:00 AM, Hugo Heden hugohe...@gmail.com wrote: Try using quotes: SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${extra_libopts_clean_files} ) Thanks! That solved my problem. And If I specify each file individually, it appears that only the last takes effect (basically subsequent calls overwrite the previous value). Surely there is a way to specify multiple files right? In such a case, you could use the APPEND functionality in set_property: http://www.cmake.org/cmake/help/ctest2.6docs.html#command:set_property SET_PROPERTY( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIRECTORY} APPEND ADDITIONAL_MAKE_CLEAN_FILES ./libopts/.libs/libopts.la ) But beware of this issue when using ADDITIONAL_MAKE_CLEAN_FILES http://public.kitware.com/Bug/view.php?id=8164 -- if there is no *target* present in the CMakeLists.txt, then the directory does not count as a directory in the cmake sense, so the directory property will be ignored. Thanks for the warning. In my case my work around of using the path to the directory of the file and placing the cmake commands in the parent directory seems to be working. -- Aaron Turner http://synfin.net/ http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix Windows Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] How to append arbitrary linker options?
Hello, I would like to be able to append arbitrary linker options to the end of my link lines on Unix/Linux systems. However, the options set in the CMAKE_EXE_LINKER_FLAGS variable are listed *before* all of the libraries that CMake knows about. I need to be able to append a bunch of nasty options like Fortran libraries, MPI libraries (in some nasty cases) and other libraries that must come after all other libraries. The problem is that while I could carefully list the libraries that need to be appended and I could use find_library(...) to get them correctly I may just have a glob of libraries and other linker options that someone gives me and I just want to apply them without having to parse everything out. Is there some way to force CMake on Unix/Linux systems to append arbitrary linker options? Thanks, - Ross ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to append arbitrary linker options?
On Fri, Jan 30, 2009 at 12:56 PM, Bartlett, Roscoe A raba...@sandia.govwrote: Hello, I would like to be able to append arbitrary linker options to the end of my link lines on Unix/Linux systems. However, the options set in the CMAKE_EXE_LINKER_FLAGS variable are listed *before* all of the libraries that CMake knows about. I need to be able to append a bunch of nasty options like Fortran libraries, MPI libraries (in some nasty cases) and other libraries that must come after all other libraries. The problem is that while I could carefully list the libraries that need to be appended and I could use find_library(...) to get them correctly I may just have a glob of libraries and other linker options that someone gives me and I just want to apply them without having to parse everything out. Is there some way to force CMake on Unix/Linux systems to append arbitrary linker options? You can use set_target_properties(foo PROPERTIES LINK_FLAGS ...) on your targets. The LINK_FLAGS property will not contain CMAKE_EXE_LINKER_FLAGS, it's merely for special flags to be appended to linking a particular target. If you need to apply the same linking flags to many targets you can create a function() to ease your pain. Also, be aware if you set the LINK_FLAGS property twice, the second call will overwrite the first. If you need to append to LINK_FLAGS (lets say you want one function to add fortran linking options and the other for MPI) you must first use get_target_property() and check to see if the property existed, and then append to it. function(add_my_mpi_ldflags _target) if(CMAKE_COMPILER_IS_GNUCC) set(new_link_flags -Whatever) get_target_property(existing_link_flags ${_target} LINK_FLAGS) if(existing_link_flags) set(new_link_flags ${existing_link_flags} ${new_link_flags}) endif() set_target_properties(${_target} PROPERTIES LINK_FLAGS ${new_link_flags}) endif() endfunction() add_executable(foo foo.cc) add_my_mpi_ldflags(foo) -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] continuous build on a branch?
Hi, How can I set up a continuous build on a branch? I've tried setting CTEST_UPDATE_OPTIONS to include the branch name, but it keeps removing the stickyness and update to the main branch. set(CTEST_CVS_CHECKOUT ${CTEST_CVS_COMMAND} -d:pserver:f...@bar.com/baz co -r branchname foobar) set(CTEST_UPDATE_OPTIONS -dP -r branchname) Thanks, Bram ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] timeout on total test time?
Hi, Is it possible to specify the total amount of time CTest may spend on running the tests? With CTEST_TIMEOUT, you can set the time CTest may spend on each test, but that's not really what I'm looking for. Thanks Bram ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to append arbitrary linker options?
Bartlett, Roscoe A wrote: Hello, I would like to be able to append arbitrary linker options to the end of my link lines on Unix/Linux systems. However, the options set in the CMAKE_EXE_LINKER_FLAGS variable are listed *before* all of the libraries that CMake knows about. I need to be able to append a bunch of nasty options like Fortran libraries, MPI libraries (in some nasty cases) and other libraries that must come after all other libraries. The problem is that while I could carefully list the libraries that need to be appended and I could use find_library(...) to get them correctly I may just have a glob of libraries and other linker options that someone gives me and I just want to apply them without having to parse everything out. Is there some way to force CMake on Unix/Linux systems to append arbitrary linker options? There is currently no explicit feature for this. You can hack it for Makefile generators by writing set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_CXX_LINK_EXECUTABLE} ${NASTY_FLAGS}) and similarly for the other languages. There is no equivalent for Visual Studio or Xcode though. Another (hack) approach is to convince CMake's link dependency analysis to put your flags at the end using a helper target: add_library(last STATIC dummy.c) target_link_libraries(last ${NASTY_FLAGS}) # ... link every target to 'last' add_library(mylib ...) target_link_libraries(mylib last) This will guarantee that 'last' comes after all other targets on link lines and that ${NASTY_FLAGS} comes after that. I suggest doing the work to find the libraries and specify them properly. Blindly passing flags from foo-config scripts could lead to trouble, especially when using multiple such flag sets. For example, consider when foo-config returns -L/path/to/foo/lib -lfoo and bar-config returns -L/path/to/bar/lib -lbar but /path/to/bar/lib contains a (wrong) version of libfoo. If these two sets of flags get appended in the wrong order the wrong foo will be found. On the other hand if the outputs of foo-config and bar-config are parsed and used to find the corresponding libraries with full paths, CMake will compute a safe link line for you. -Brad ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] telling find_package exactly where to find a package
On Fri, Jan 30, 2009 at 01:11:13AM -0500, Philip Lowman wrote: Read the documentation for the find_path() and find_library() commands. Setting the variable CMAKE_PREFIX_PATH (or environment variable) will likely be of tremendous help to you. Ah, yes. This is why a close re-reading of the find_package docs was also on my todo list for today :). Thanks Philip! This is what I was looking for. tyler ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to configure build output directory
During development, I don't expect INSTALL targets will be used at all. The main reason I initially wanted this directory structure was because I was planning to have a configuration file for each application, and I thought I would name it "configuration". However, if all the executables are in the same directory, they can't all have configuration files with the same name. When I thought of this problem, it occurred to me this would not be a problem on the Macintosh, as all the executables are placed in bundles, which are really just directory structures disguised as a single application file. I knew the file could simple be embedded into the bundle, and I thought perhaps I could apply a similar strategy to other platforms. My solution now it to just use name of the application for the configuration file. Philip Lowman wrote: On Thu, Jan 29, 2009 at 9:47 PM, Tron Thomas tron.tho...@verizon.net wrote: The point about the PATH needed for DLL's under this directory structure is something I forgot to take into account when I was contemplating how to organize things. It would not work out well with what I had in mind. Given that, I think I will have to consider a different strategy. Most people just set CMAKE_RUNTIME_OUTPUT_PATH once (usually to "bin") and INSTALL() targets to a runtime output path (also usually "bin") and call it a day. Let us know what you come up with though. =) -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Custom CMake module in project
I have a CMake module that is not in the module repository and cannot quite figure out the right way to include it in my project. I've put FindMHASH.cmake in the root path of the project, as well as put it under 'Modules' in there. I've performed: set(CMAKE_MODULES_PATH Modules) in the root CMakeLists.txt and have run into an error: luminous:cryptoface harningt$ make /sw/bin/cmake -H/Users/harningt/gitrepo/cryptoface -B/Users/harningt/ gitrepo/cryptoface --check-build-system CMakeFiles/Makefile.cmake 0 CMake Error at cf_mhash/CMakeLists.txt:4 (find_package): find_package Error reading CMake code from Modules/FindMHASH.cmake. -- Configuring incomplete, errors occurred! make: *** [cmake_check_build_system] Error 1 ... running various cmake debug/trace options do not seem to reveal how to handle this... ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Custom CMake module in project
On Fri, Jan 30, 2009 at 11:56 PM, Thomas Harning harni...@gmail.com wrote: I have a CMake module that is not in the module repository and cannot quite figure out the right way to include it in my project. I've put FindMHASH.cmake in the root path of the project, as well as put it under 'Modules' in there. I've performed: set(CMAKE_MODULES_PATH Modules) typo and/or you're assuming that setting the variable works with a relative path, which it does not. Try the following from the parent directory of Modules: set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules) -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake