Re: [CMake] find_library fails when cross compiling
In case anyone else hits this, I figured it out. The issue was that our toolchain file specified "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY" which meant it was ignoring our PATH list. Changing it to "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH" solved the issue. On Mon, Mar 26, 2018 at 6:06 PM Oliver Dain <oli...@revl.com> wrote: > Hi, > > I have some find_library lines like the following: > > find_library(protobuf_protobuf protobuf PATHS > /Users/oliverdain/Documents/code/revl/.install/${ARCH}/${VARIANT}/protobuf/3.4.1.r1/lib > NO_DEFAULT_PATH ) > target_link_libraries(ml_editing PUBLIC ${protobuf_protobuf}) > > These work find when $ARCH and $VARIANT are set to OSX and either Debug or > Release (my target system). However, If I run > > cmake -H. > -B/Users/oliverdain/Documents/code/revl/cpp/build/build/IPHONE/Release > -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DIOS_PLATFORM=OS > -DCMAKE_BUILD_TYPE=Release -DARCH=IPHONE -DVARIANT=Release > > the libraries are reported not found (the standard "CMake Error: The > following variables are used in this project, but they are set to > NOTFOUND." error) even though the libraries are in the specified location. > For example, it says it can't find the protobuf libs but an ls yields: > > $ ls > /Users/oliverdain/Documents/code/revl/.install/IPHONE/Release/protobuf/3.4.1.r1/lib > cmake libprotobuf-lite.a libprotobuf.a pkgconfig > > Note that if I change the NO_DEFAULT_PATH specification in the > find_library line to NO_CMAKE_FIND_ROOT_PATH everything works as expected > and the libs are found and linked (and I know its the right libs because > things also run). > > Is this a bug or is there something I don't understand about > NO_DEFAULT_PATH? > > Thanks, > Oliver > > PS: I know the hard coded full path names are odd - the CMakeLists.txt > files are actually generated -- it's a long story. > -- 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: https://cmake.org/mailman/listinfo/cmake
[CMake] find_library fails when cross compiling
Hi, I have some find_library lines like the following: find_library(protobuf_protobuf protobuf PATHS /Users/oliverdain/Documents/code/revl/.install/${ARCH}/${VARIANT}/protobuf/3.4.1.r1/lib NO_DEFAULT_PATH ) target_link_libraries(ml_editing PUBLIC ${protobuf_protobuf}) These work find when $ARCH and $VARIANT are set to OSX and either Debug or Release (my target system). However, If I run cmake -H. -B/Users/oliverdain/Documents/code/revl/cpp/build/build/IPHONE/Release -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DIOS_PLATFORM=OS -DCMAKE_BUILD_TYPE=Release -DARCH=IPHONE -DVARIANT=Release the libraries are reported not found (the standard "CMake Error: The following variables are used in this project, but they are set to NOTFOUND." error) even though the libraries are in the specified location. For example, it says it can't find the protobuf libs but an ls yields: $ ls /Users/oliverdain/Documents/code/revl/.install/IPHONE/Release/protobuf/3.4.1.r1/lib cmake libprotobuf-lite.a libprotobuf.a pkgconfig Note that if I change the NO_DEFAULT_PATH specification in the find_library line to NO_CMAKE_FIND_ROOT_PATH everything works as expected and the libs are found and linked (and I know its the right libs because things also run). Is this a bug or is there something I don't understand about NO_DEFAULT_PATH? Thanks, Oliver PS: I know the hard coded full path names are odd - the CMakeLists.txt files are actually generated -- it's a long story. -- 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: https://cmake.org/mailman/listinfo/cmake
[cmake-developers] Antwort: Re: Non supported toolchain
Hi Alex, thanks for your answer. 1. is there some guide or at least some example? 2. Does this module needs to be in the offical build to be distributed or is there a possibility to distribute the modules locally? Thanks! Oli Von:Alexander NeundorfAn: cmake-developers@cmake.org Datum: 22.11.2017 21:52 Betreff:Re: [cmake-developers] Non supported toolchain Gesendet von: "cmake-developers" On 2017 M11 22, Wed 10:37:00 CET oliver.za...@egoproducts.com wrote: > Hi, > > i know this is the dev mailing list, but i tried to solve my problem in > the normal one (see here > https://www.mail-archive.com/cmake@cmake.org/msg57862.html) with no > success. > > In Short: i have a toolchain for an microcontroller (renesas rx serjes) > running on windows. I want to build my project with cmake and therefor > wrote a toolchain file. > The problem now is, that the compiler needs instead of "-I" for includes > "-include=" and for defines "-define=". I found out that there seems to be > internal variables CMAKE_INCLUDE_FLAG_C and CMAKE_DEFINE_FLAC_C but they > don't seem to accesible from the toolchain file. > > Is there any chance beside writing a new module for a compiler to get this > toolchain running? no, you probably need to write a module file for the compiler. This is actually not that complicated. Alex -- 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-developers -- 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-developers
[cmake-developers] Non supported toolchain
Hi, i know this is the dev mailing list, but i tried to solve my problem in the normal one (see here https://www.mail-archive.com/cmake@cmake.org/msg57862.html) with no success. In Short: i have a toolchain for an microcontroller (renesas rx serjes) running on windows. I want to build my project with cmake and therefor wrote a toolchain file. The problem now is, that the compiler needs instead of "-I" for includes "-include=" and for defines "-define=". I found out that there seems to be internal variables CMAKE_INCLUDE_FLAG_C and CMAKE_DEFINE_FLAC_C but they don't seem to accesible from the toolchain file. Is there any chance beside writing a new module for a compiler to get this toolchain running? Thanks a lot and sorry for asking on the dev list! Best regards, Oliver-- 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-developers
[CMake] Antwort: Re: Re: Antwort: Antwort: Re:Antwort: Re: Toolchain with non-gcc argument format
Hi Eric, thanks a lot for your help! i'm going to try it on the dev mailing list. Cheers, Oliver Von:Eric Noulard <eric.noul...@gmail.com> An: oliver.za...@egoproducts.com Kopie: CMake Mailinglist <cmake@cmake.org> Datum: 22.11.2017 09:49 Betreff:Re: Re: [CMake] Antwort: Antwort: Re:Antwort: Re: Toolchain with non-gcc argument format Hi Olivier, Putting the list back. You may try developer list as well. 2017-11-22 9:02 GMT+01:00 <oliver.za...@egoproducts.com>: Hi, Is there really no way to override this var with a toolchain file? that seems somehow strange to me, since CMAKE is so configurable that i can't change "-I" to "-include=" what do i have to do? I'm sorry I'm a little short in time to investigate that with you at the moment and I hope some other people may step in. The var "CMAKE_INCLUDE_FLAG_C" is NOT a toolchain file variable and it won't end-up in the cache file. AFAIK It is **only** used in compiler detection, e.g. at early stage of project configuration when processing project(...) or enable_language(..) Adding new toolchain is not as flexible as adding a new **kind** of compiler. The knobs accessing for writing a toolchain are described here: https://cmake.org/cmake/help/v3.10/manual/cmake-toolchains.7.html There you can see that: "Languages are enabled by the project() command. Language-specific built-in variables, such as CMAKE_CXX_COMPILER, CMAKE_CXX_COMPILER_ID etc are set by invoking the project() command." Unless I'm wrong the toolchain mechanism does not include the capability to change "-I" to "-include". Now adding a new "kind" of compiler, a.k.a. compiler ID, enables you to specify that include directive flag is " -include" (and many other things as well) Adding a new compiler ID requires to add files in /Modules/Compiler (see https://github.com/Kitware/CMake/tree/master/Modules/Compiler) as you can see it requires at least a couple of file to find a compiler and one file per supported language (C, CXX, etc...) in the C or CXX specific file you may use CMAKE_INCLUDE_FLAG_C and other variables: see e.g.: https://github.com/Kitware/CMake/blob/master/Modules/Compiler/TI-C.cmake I did never add a new kind of compiler so I hope people with more knowlegde than me in this area will explain that part better than me. Eric 2017-11-16 9:44 GMT+01:00 <oliver.za...@egoproducts.com>: I did not find the CMAKE_INCLUDE_FLAG_C in the CMake cache - is it possible that this is somehow ignored? This variable is used by CMake **builtin compiler** discovery and configuration. The file are are put in "Modules/Compiler" there is one per-langage and per-compiler ID: https://cmake.org/cmake/help/v3.7/variable/CMAKE_LANG_COMPILER_ID.html I don't know the exact processing order of this set of files. Toolchain files: https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html does not use or contain such variables. -- Eric -- Eric -- 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] Predownload
Hi, thanks a lot for your input. I will take a look at the SuperProject (with ExternalProject_Add() call) constellation as well as the meta build tools. I'm quite new to this stuff, so please allow me my question: does this even make sense what i'm trying or are there some "patterns" that handles this stuff that i'm not aware of? Gesendet: Dienstag, 18. April 2017 um 00:23 Uhr Von: "Craig Scott" <craig.sc...@crascit.com> An: "Florent Castelli" <florent.caste...@gmail.com> Cc: CMake <cmake@cmake.org>, "Zabel, Oliver" <oliverza...@gmx.de> Betreff: Re: [CMake] Predownload The top level build doesn't actually need to build anything itself. It would just become a sequence of ExternalProject_Add() calls with some simple logic for selecting which things to turn on/off, etc. The first ExternalProject_Add() would download the toolchain files. The subsequent ExternalProject_Add() calls could then use those toolchain files in their configure steps. You just need to ensure you create the dependencies between the ExternalProject targets to ensure the toolchain downloads happen before the other ExternalProject targets that need them. On Tue, Apr 18, 2017 at 8:21 AM, Florent Castelli <florent.caste...@gmail.com> wrote: Don't you need the toolchain to be configured (Aka project() called) before ExternalProject? You wouldn't be able to update it after the download. /Florent On Apr 17, 2017 11:18 PM, "Craig Scott" <craig.sc...@crascit.com> wrote: Actually, ExternalProject could even be used to download and unpack the toolchain files in a superbuild arrangement too. Probably makes more sense now that I think about it, since it provides unpacking as well, not just downloading and has a much richer set of download methods. On Tue, Apr 18, 2017 at 8:16 AM, Craig Scott <craig.sc...@crascit.com> wrote: One option may be a superbuild arrangement (based on ExternalProject, online searches should give you details). The only thing the top level would do is setup the sub builds, including downloading and selecting which toolchain(s) to use for each sub build. On Tue, Apr 18, 2017 at 8:03 AM, Florent Castelli <florent.caste...@gmail.com> wrote: It is possible. Nothing prevents you from calling execute_process to download as extract your toolchain file when it is run. You probably want to check the destination folder for a pre existing download though. If you use file(DOWNLOAD...) for downloading the toolchain files and you specify an EXPECTED_HASH, this will also conveniently take care of only downloading the file if it isn't already present. Shouldn't need to resort to execute_process() to do the download. Then, you proceed on configuring Cmake to use it as usual. /Florent On Apr 17, 2017 14:11, "Zabel, Oliver" <oliverza...@gmx.de> wrote: Hi, i’m developing Software for embedded Systems and my applications Need to run on different target platforms. Until now we are build our Code with make but i’d like to Switch to cmake. ATM we’re putting our Compiler toolchains in our VCS to be able to produce the same binarys even after years. Until now, there is only one toolchain include in a Project as svn-external/git submodule. But i want to use toolchain-files with cmake. Now here is my idea and i’d like to know whether this is possible with cmake. I have my Project root and in this Folder i’d like to have different toolchain files for different Compilers. I’d like to exclude the Compilers as external. Now i’d like to build the cmake Cache by calling cmake with the required toolchain file. Is it now somehow possible, to download the required toolchain before the Cache is buidl up? If this would be possible, i could dynamicly choose which toolchain i want to have – would be great for Compiler / unit Tests as well. Perhaps someone has a better idea to do this or even i using such a System and give me a hint? Thanks a lot! Best regards, Oliver -- 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 -- 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://cmak
[CMake] Predownload
Hi, i’m developing Software for embedded Systems and my applications Need to run on different target platforms. Until now we are build our Code with make but i’d like to Switch to cmake. ATM we’re putting our Compiler toolchains in our VCS to be able to produce the same binarys even after years. Until now, there is only one toolchain include in a Project as svn-external/git submodule. But i want to use toolchain-files with cmake. Now here is my idea and i’d like to know whether this is possible with cmake. I have my Project root and in this Folder i’d like to have different toolchain files for different Compilers. I’d like to exclude the Compilers as external. Now i’d like to build the cmake Cache by calling cmake with the required toolchain file. Is it now somehow possible, to download the required toolchain before the Cache is buidl up? If this would be possible, i could dynamicly choose which toolchain i want to have – would be great for Compiler / unit Tests as well. Perhaps someone has a better idea to do this or even i using such a System and give me a hint? Thanks a lot! Best regards, Oliver -- 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] can't locate library with find_library
oh, no, silly me, I didn't. that fixed the problem. thx Feiyi On Wed, Mar 22, 2017 at 10:08 AM, Nils Gladitz <nilsglad...@gmail.com> wrote: > On 22.03.2017 14:52, Oliver wrote: > >> hi all, >> >> I am running cmake 3 using EPEL install on RHEL 7. I also have installed >> "gflags", >> >> >> >> $rpm -ql gflags >> /usr/bin/gflags_completions.sh >> /usr/lib64/libgflags.so.2.1 >> /usr/lib64/libgflags_nothreads.so.2.1 >> /usr/share/doc/gflags-2.1.1 >> /usr/share/doc/gflags-2.1.1/AUTHORS.txt >> /usr/share/doc/gflags-2.1.1/COPYING.txt >> /usr/share/doc/gflags-2.1.1/ChangeLog.txt >> /usr/share/doc/gflags-2.1.1/README.txt >> >> > Did you also install the corresponding development package e.g. > "gflags-devel"? > > Nils > -- Oliver -- 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] can't locate library with find_library
hi all, I am running cmake 3 using EPEL install on RHEL 7. I also have installed "gflags", $rpm -ql gflags /usr/bin/gflags_completions.sh /usr/lib64/libgflags.so.2.1 /usr/lib64/libgflags_nothreads.so.2.1 /usr/share/doc/gflags-2.1.1 /usr/share/doc/gflags-2.1.1/AUTHORS.txt /usr/share/doc/gflags-2.1.1/COPYING.txt /usr/share/doc/gflags-2.1.1/ChangeLog.txt /usr/share/doc/gflags-2.1.1/README.txt but my check fails: # glags find_library(GFLAGS_LIB NAMES gflags PATHS /usr/lib64 /usr/lib /usr/local/lib) if (NOT GFLAGS_LIB) message(STATUS "gflags is not present, you can still control logging through env settings") message(STATUS "GLOG_logtostderr=1 ./your_application") else() message(STATUS "gflags is present, you can controll logging through command line:") message(STATUS "./your_application --logtostderr=1") endif() what did I do wrong? thx. -- Oliver -- 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] surround executable with flags
Hi, i trying to migrate a cross-compiler project (ARM on Windows) from an IDE (Cypress PSoC Creator) to cmake. The toolchain is a standard gcc for arm. The IDE compiles the binary with arm-none-eabi-gcc.exe -Wl,--start-group . -Wl,--end-group. I'm trying to reach the same in cmake, but since add_executable(target main.c) together with target_link_libraries() at least the main-file is outside the start / end-group. Is there a way to achive this? The problem is, that the code-size differs between the IDE build and cmake build and i need to know at least why. And since the group issue is the last thing, i need to get around it. Thanks for help! Best regards, Oliver-- 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] surround add_executable with flags
Hi, i trying to migrate a cross-compiler project (ARM on Windows) from an IDE (Cypress PSoC Creator) to cmake. The toolchain is a standard gcc for arm. The IDE compiles the binary with arm-none-eabi-gcc.exe -Wl,--start-group . -Wl,--end-group. I'm trying to reach the same in cmake, but since add_executable(target main.c) together with target_link_libraries() at least the main-file is outside the start / end-group. Is there a way to achive this? The problem is, that the code-size differs between the IDE build and cmake build and i need to know at least why. And since the group issue is the last thing, i need to get around it. Thanks for help! Best regards, Oliver-- 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-developers] Patch for FindIconv support
Hello everyone, This is my first post to this mailing list. So don't rail me too hard if my patch is way off base. The patch is attached. I actually wrote it quite a while ago but never got around to submitting it. Please take a good look at it and let me know what issues you see with it. Thank you, Steven N. Oliver 0001-Add-new-FindIconv-module.patch Description: Binary data -- 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-developers
[CMake] Check header file woos
All, I am trying to use CheckIncludeFiles for header file check. I know the file I want to check is located at /usr/include/lustre, so I supplied the following: include(CheckIncludeFiles) check_include_files(lustre/lustre_user.h HAVE_LUSTRE_USER_H) And it report can't find. Then I tried to be explicit about it set(CMAKE_REQUIRED_INCLUDES /usr/include/lustre) Still no avail. If I check any other header file in that directory, say sys/io.h, it will work as expected. I am puzzled ... anything I missed? Thanks -- Oliver -- 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://www.cmake.org/mailman/listinfo/cmake
[CMake] [PATCH] New FindIconv module
Attached is a patch that will find the iconv library by testing to make sure it exists by compiling a sample C file. Thank you, Steven N. Oliver 0001-Add-new-FindIconv-module.patch Description: Binary data -- 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] Need to prepend compiler with static analysis tool
On 5/23/2012 4:45 PM, jrosensw wrote: Hi Alexander, I tried this already. However I'm not sure what a clean build tree means. Maybe thats my problems. All I did was this: CXX=path/insurepath/g++ cmake . But when I compiled I did not see a change. How do I get my tree to a clean state? Other than running make clean which I did do. rm -rf CMakeCache* CMakeFiles* - Oliver -- 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] Master-switch options
I'm looking to have a certain group of variables controlled primarily by one master setting I want the cache value to be ignored when the user explicitly provides the master variable on the command line and whenever the value of the variable changes. Put another way: When the user EXPLICITLY specifies or changes the value of MasterVariable, I want to delete the values of ${${AffectedVariables_MasterVariable}} from the cache. Example: Master: VARIANT Controls: SSE2, SSE3, PACKAGE_FORMAT Setting1: VARIANT=Internal, SSE2=OFF, SSE3=OFF, PACKAGE_FORMAT=TGZ Setting83: VARIANT=Eval, SSE2=ON, SSE3=ON, PACKAGE_FORMAT=DEB Setting509: VARIANT=Client623, SSE=ON, SSE3=OFF, PACKAGE_FORMAT=RPM PIZZA: XL ... CMakeCache.txt values: VARIANT=Internal, SSE2=ON, SSE3=OFF, PACKAGE_FORMAT=TGZ, PIZZA=L $ cmake -DVARIANT=Internal -DPIZZA=Medium VARIANT=Internal, *SSE2=OFF*, SSE3=OFF, PACKAGE_FORMAT=TGZ, PIZZA=M (SSE2 was reset to it's default value) $ cmake -DPACKAGE_FORMAT=RPM -DVARIANT=Internal VARIANT=Internal, SSE2=OFF, SSE3=OFF, PACKAGE_FORMAT=RPM, PIZZA=M (All values were reset but the -DPACKAGE_FORMAT overrode the default of that option, non-controlled value, PIZZA, left alone) $ cmake -DEval VARIANT=Eval, *SSE2=ON*, *SSE3=ON*, *PACKAGE_FORMAT=DEB*, PIZZA=M (previously user-specified package_format was reset because it was not explicitly provided) $ cmake . (No changes because no VARIANT explicitly specified) If this was being implemented by deleting the CMakeCache.txt file, then the value of PIZZA would be continually clobbered along with all the other values... Is there a way to do this? I'm wanting to build it something like: OPTION(SSE2 Enable SSE2 instructions OFF)-- General default. ... IF ( VARIANT BECOMES Internal ) DEFAULT(SSE2 OFF) DEFAULT(SSE3 OFF) DEFAULT(PACKAGE_FORMAT TGZ) ELSEIF ( VARIANT BECOMES Eval ) DEFAULT(SSE2 ON) DEFAULT(SSE3 OFF) DEFAULT(PACKAGE_FORMAT DEB) ELSEIF ( VARIANT BECOMES Client623 ) DEFAULT(SSE2 ON) DEFAULT(SSE3 OFF) DEFAULT(PACKAGE_FORMAT RPM) ELSEIF ... Or perhaps the slightly less error-prone: OPTIONS(name of control variable VALUE value to default to DEFAULTS VARIABLE:VALUE ...) This would then complain about the following, because the second OPTIONS has a different list for the same control as the previous incarnation: OPTIONS(VARIANT VALUE Internal DEFAULTS SSE2 OFF SSE3 OFF PACKAGE_FORMAT TGZ ) OPTIONS(VARIANT VALUE Eval DEFAULTS SSE2 ON SES3 OFF# Typo PACKAGE_FORMAT DEB ) OPTIONS(VARIANT VALUE Client623 DEFAULTS SSE2 ON SSE3 OFF PACKAGE_FORMAT RPM ) Another advantage of this is that the GUI/CCMake could use these to build a drop-down list of VARIANT settings, and CMake itself could ascertain that -DVARIANT=Intrenal (typo) is invalid (-DVARIANT is used in OPTIONS but there is no OPTIONS that matches Intrenal). - Oliver -- 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] Couple of library/link questions
Andreas Pakulat said the following on 3/20/2012 5:21 PM: - The makefiles I'm basing this on build libevent_core.lib, libevent_extras.lib and then libevent.lib which is basically the two previous libraries merged. I wanted to do: ADD_LIBRARY(libevent_core ${CoreSrcFiles}) ADD_LIBRARY(libevent_extras ${ExtraSrcFiles}) ADD_LIBRARY(libevent) TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras) but this generates a warning/error, listing the two libraries in Whats the error? It should just work. I mis-spoke; it gives a /warning/ for the ADD_LIBRARY(libevent) with no source files, warning that it is usually an error in the CMakeLists.txt file. - Oliver -- 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] Couple of library/link questions
I'm trying to make a CMakeLists for libevent, and had a couple of questions that would make it a bit cleaner: - Other than using a macro to do { add_executable(...) target_link_libraries(...) } is there a /clean/ way to make everything in a subdirectory automatically link a given library? - The makefiles I'm basing this on build libevent_core.lib, libevent_extras.lib and then libevent.lib which is basically the two previous libraries merged. I wanted to do: ADD_LIBRARY(libevent_core ${CoreSrcFiles}) ADD_LIBRARY(libevent_extras ${ExtraSrcFiles}) ADD_LIBRARY(libevent) TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras) but this generates a warning/error, listing the two libraries in add_library doesn't work either. So for now I have ADD_LIBRARY(libevent_core ${CoreSrcFiles}) ADD_LIBRARY(libevent_extras ${ExtraSrcFiles}) ADD_LIBRARY(libevent ${CoreSrcFiles} ${ExtraSrcFiles}) but that's clumsy :) - Oliver -- 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 make package depend on tests?
I have test and package configurations on my project, I want: cmake . make package to run force injection of the test target prior to building the package target. Can it be done? How? :) -- 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] Partial 3rd-party library management
In order to maximize our ability to rebuild an exact copy of a previous revision, our repository carries copies of numerous 3rd party libraries. However, in most of their cases we are fairly selective about which elements we build. Downside: make clean make winds up rebuilding all the damn libraries :) At the same time, we have a large number of customized project-wide customizations, depending on which client / product version we're building for. So, when we are building - as opposed to developing - we need the ability to easily perform a full rebuild, including possibly the libraries. For a nominal development clean build, upto 70% of the build time is spent building 3rd party libraries. Right now - for simplicity - we actually assemble the 3rd libraries from the top level CMakeLists.txt directly (ok, simplicity and a failure on my part to work out how to express that libraryXXX.a is an output of subfolderX). /The problem/ Something like a source-control revert can sometimes put /our/ part of the code base into a state that requires a clean. However, we don't want to cause the libraries to rebuild /except/ when someone changes compilation flags or forces a rebuild of the libraries somehow else (e.g. a cleanall target). Is there a way to do this with cmake? Or is this problem only because I haven't (yet) split these libraries into their own CMakeLists files? The simplest and therefore easiest complete example I have is: 8x --- snip --- x8 add_library(ircclient SHARED libircclient/src/libircclient.c) set_property(TARGET ircclient PROPERTY COMPILE_DEFINITIONS IN_BUILDING_LIBIRC) link_directories( ${Project_BINARY_DIR}/ircclient ) 8x --- snip --- x8 - Oliver -- 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 precompiled header attempts
I've spent all day trying to get a single precompiled header to work on a series of targets within a rather complex project. I'll profess to a fair amount of stabbing in the dark. I came up with the following, but it doesn't bother building the PCH until the *end* of the first target. And then it fails because it doesn't have the compiler definitions needed. So, how do I get my ADD_PCH(targetname) macro to prioritize the PCH file, without making it always build the pch? Note: All of the candidate targets use the project include files, compiler flags and definitions.// 8x --- snip --- x8 SET(_PCH_SRC ${Project_SOURCE_DIR}/cfg/syscfg.h) SET(_PCH_HDR ${_PCH_SRC})# Viable as a dependency name. IF ( _USE_PCH ) IF (WINDOWS) SET(_PCH_HDR ${_PCH_SRC}.pch) ELSE () SET(_PCH_HDR ${_PCH_SRC}.gch) ENDIF() SET(_pchFlags ${CMAKE_CXX_FLAGS}) GET_DIRECTORY_PROPERTY(_pcfIncludePaths INCLUDE_DIRECTORIES) FOREACH (_inc ${_pcfIncludePaths}) LIST(APPEND _pchFlags -I ${_inc}) ENDFOREACH() GET_DIRECTORY_PROPERTY(_pcfIncludePaths COMPILE_DEFINITIONS) FOREACH (_inc ${_pcfIncludePaths}) LIST(APPEND _pchFlags -D ${_inc}) ENDFOREACH() SEPARATE_ARGUMENTS(_pchFlags) ADD_CUSTOM_COMMAND( PRE_BUILD OUTPUT ${_PCH_HDR} COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_pchFlags} -o ${_PCH_HDR} ${_PCH_SRC} MAIN_DEPENDENCY ${_PCH_SRC} IMPLICIT_DEPENDS CXX ${_PCH_SRC} DEPENDS ${_PCH_SRC} ) ENDIF ( _USE_PCH ) MACRO(ADD_PCH _TARGET) IF ( WW2_USE_PCH ) MESSAGE(STATUS Adding pch to ${_TARGET}) add_dependencies(${_TARGET} ${_PCH_HDR}) ENDIF ( ) ENDMACRO() 8x --- snip --- x8 For bonus points: The business of having to copy the include paths and compiler definitions seems really clumsy, it's horribly platform dependent. Surely there's a better way say build it the same way you'd build anything else in this directory - Oliver -- 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] Is there a cookbook?
On 2/23/2012 9:37 PM, John Drescher wrote: You probably want to do some type of file GLOBBING for that Here is an example of file globbing (along with its pitfalls): http://www.cmake.org/pipermail/cmake/2010-September/039558.html I am sorry. It does not look like the code to glob is there. I am to tired to look for more examples now. Yep, this morning I was able to piece together what I needed - but my point here is that we really need a CMake CookBook or snippet repository. I always hit the FAQ first, but that /explains/ when what a coder tends to need in that frame of mind is a living example. I appreciate your time looking for a solution for my issue, though :) - Oliver -- 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] External projects and make clean
Hi, I use external projects e.g. to build BOOST for my own project. In that case I want to prevent the project to be system or version dependent. So I build my dependencies successful with external project (and its great), but if use make clean it will clean all stuff and I have to rebuild the external projects again (take some time with BOOST). Is there a solution to prevent an external project from cleaning when I call 'make clean'? Kind regards Oliver Boesche -- 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] Making a variable a dependency...
Alexander Neundorf said the following on 2/6/2012 3:56 PM: Would it be acceptable if cmake would rerun after every build ? You could enforce that e.g. with a add_custom_command( POST_BUILD ... ) which could e.g. touch CMakeCache.txt or something. Better ideas ? We're working in a client/server environment in a fairly agile production environment; we need to have /all/ executables correctly stamped with the revision they're sourced from. So I kind of need it run before each build. Further, one of my problems is that right now the variable gets cached in CMakeCache.txt, so I have to delete CMakeCache.txt or do cmake -DSubversion_FOUND=NO or similar. In the short term, I can just make it always rebuild the revision.h, but that has the downside of causing it to /always/ rebuild the library that includes it, causing all binaries to relink, and so on, which is fairly time consuming (it's a very large project :) -- 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] Making a variable a dependency...
Michael Hertling said the following on 2/6/2012 6:39 PM: On 02/06/2012 10:56 PM, Alexander Neundorf wrote: On Saturday 04 February 2012, Oliver Smith wrote: My CMakeLists uses the Subversion repository information in a couple of places (it configures a file revision.h and it uses it for the CPack package name). The problem is that this variable is cached and retained until the cache is rebuilt, instead of being calculated or evaluated per make. So if I do a build, then do an svn update and pull some changes, it will build a new executable but it will stamp it with the revision number from when CMake last regenerated the make files... Is there a way to mark a variable as volatile or something so that CMake will always recalculate it and check if it has changed? Would it be acceptable if cmake would rerun after every build ? You could enforce that e.g. with a add_custom_command( POST_BUILD ... ) which could e.g. touch CMakeCache.txt or something. Better ideas ? Delay the generation of the revision.h header until build phase via a custom command; look at the following exemplary project: # CMakeLists.txt: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(P C) SET(CMAKE_VERBOSE_MAKEFILE ON) ADD_CUSTOM_COMMAND(OUTPUT dummy revision.h COMMAND ${CMAKE_COMMAND} -DBD=${CMAKE_BINARY_DIR} -DWC=${CMAKE_SOURCE_DIR} -P ${CMAKE_SOURCE_DIR}/revision.cmake) FILE(WRITE ${CMAKE_BINARY_DIR}/main.c #includestdio.h #include \revision.h\ int main(void) { printf(\%d\\n\,REVISION); return 0; } ) ADD_EXECUTABLE(main main.c revision.h) # revision.cmake: FIND_PACKAGE(Subversion) Subversion_WC_INFO(${WC}@HEAD P) FILE(WRITE ${BD}/revision.h.in #define REVISION @P_WC_REVISION@\n) CONFIGURE_FILE(${BD}/revision.h.in ${BD}/revision.h @ONLY) A make run rebuilds the main target whenever the repository's head revision has changed - possibly inappropriate for actual usage, just for demonstration purposes; adapt the revision.cmake script to suit the needs. BTW, can anybody confirm that the above-noted example doesn't work if the order of dummy and revision.h in the custom command is reversed? AFAICS, revision.h is removed after being generated in this case, so the subsequent compilation fails. Unless I'm missing something, that won't work because P_WC_REVISION gets cached in the CMakeCache.txt -- or does using -P cause it to skip the caching? - Oliver -- 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] Making a variable a dependency...
My CMakeLists uses the Subversion repository information in a couple of places (it configures a file revision.h and it uses it for the CPack package name). The problem is that this variable is cached and retained until the cache is rebuilt, instead of being calculated or evaluated per make. So if I do a build, then do an svn update and pull some changes, it will build a new executable but it will stamp it with the revision number from when CMake last regenerated the make files... Is there a way to mark a variable as volatile or something so that CMake will always recalculate it and check if it has changed? -- 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] Portable revision lookup?
Right now I wrap my Linux-based build process with a script that features the line REVISION=`svn info ${SRC_PATH} | awk '/^Revision/ { print $2 }'` Which is neither OS or VCS portable. I'm trying to put together a CPack configuration to make the builds, and I'd like to name the resulting installer for the revision it was built from. Is there any kind of built-in mechanism I can use for this, or would I be best just using IFs and executing os-specific commands? (I'm not quite sure how I'm going to pluck the info out under Windows) I'm also wondering if there is a way to query other repository attributes - specifically the URL - I'd like to build installers named product.branch.revision.suffix e.g. my-client.baseline.57721.deb or my-server.branches.1.35.57804.tbz2 Any pointers? - Oliver -- 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] Portable revision lookup?
John Drescher said the following on 2/2/2012 3:36 PM: Cmake has support for pulling the svn and I believe git revs using cmake modules. Here is what I do for svn Much appreciated -- I just didn't think to look in the Find package, duly noted for future reference. - Oliver -- 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] Portable revision lookup?
Oliver kfsone Smith said the following on 2/2/2012 4:17 PM: John Drescher said the following on 2/2/2012 3:36 PM: Cmake has support for pulling the svn and I believe git revs using cmake modules. Here is what I do for svn Much appreciated -- I just didn't think to look in the Find package, duly noted for future reference. - Oliver Hrm - ran into a problem with that, the revision is only produced when cmake rolls the Makefiles. I.e, if you do the following: $ cd /tmp mkdir cmake-test cd cmake-test svnadmin create repo svn co file:///tmp/cmake-test/repo src || echo Failed $ cat CMakeLists.txt END_CMAKE CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(Test) FIND_PACKAGE(Subversion REQUIRED) MESSAGE(Checking SVN Info of ${Test_SOURCE_DIR} - Repo) Subversion_WC_INFO(${Test_SOURCE_DIR} Repo) MESSAGE(Repo_WC_REVISION = ${Repo_WC_REVISION}) $ cmake -G Unix Makefiles . ... $ make ... /Repo_WC_REVISION=0/ $ svn add CMakeLists.txt svn commit -m Bump to revision 1 svn update ... /At revision 1./ $ make /Repo_WC_REVISION=0/ In particular, this prevents me using it to generate CPack package names :( - Oliver -- 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 / Debian install location
osmith@luciddev:~/pn/WW2/src$ cmake --version cmake version 2.8.2 I can't see to get make package to generate Debian packages that install any place but /usr/bin. (I actually want them in /playnet/ra/bin, /playnet/ra/lib and so on) SET(CPACK_GENERATOR DEB) SET(CPACK_INSTALL_PREFIX /playnet/ra) SET(CPACK_PACKAGE_INSTALL_PREFIX /playnet/ra) SET(CPACK_DEBIAN_INSTALL_PREFIX /playnet/ra) SET(CPACK_PACKAGE_VERSION ${REPO_WC_REVISION}.${CMAKE_BUILD_TYPE}-${WW2_TARGET_ENV}) SET(CPACK_PACKAGE_NAME servers) SET(CPACK_PACKAGE_VENDOR Cornered Rat Software) SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY Game servers) SET(CPACK_PACKAGE_DESCRIPTION 'Game servers and tools.) SET(CPACK_DEBIAN_PACKAGE_MAINTAINER Oliver Smith) SET(CPACK_DEBIAN_PACKAGE_INSTALL_PREFIX /playnet/ra) SET(CPACK_DEBIAN_PACKAGE_DEPENDS libopenthreads-dev (= 2.8.3-4), lua5.1 (= 5.1.4-5), libmysqlclient16 (= 5.1.49), bash (= 4.1), gdb (= 7.2), nfs-common, mysql-server (= 5.1), nfs-kernel-server) SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION Game servers) SET(CPACK_DEBIAN_PACKAGE_SECTION Network) SET(CPACK_DEBIAN_PACKAGE_PRIORITY Important) SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS vim, mysql-client (= 5.1), python (= 2.6.6)) SET(CPACK_DEBIAN_PACKAGE_SUGGESTS lvm2, perl (= 5.1)) I've played with a half dozen other variable name combinations, but it still all goes into /usr. - Oliver -- 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] Revision header
I have a script that generates a revision.h file, I've spent the morning trying to figure out how to make it so that ... any time CMake rebuilds any of the other targets, it starts by running the make-new-revision script. The idea is, I use the script manually to upversion, but anytime I type make and /anything/ has to be done (even just a relink), it will do the upversion first. I've only managed to make it either source dependent or always build, which forces the versionNo file to recompile and forces all executables to relink, so if you type: make ; make ... it will have to relink the executables the second time because of an pointless upversion :) - Oliver -- 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] Compile multiple-sources at a time?
I realize not every build environment supports the option, but is there a way to get CMake to generate Makefiles which aggregate source files, e.g. $ g++ -pipe -o library.a lib1.cpp lib2.cpp lib3.cpp $ g++ -pipe -o exeutable file1.cpp file2.cpp file3.cpp library.a - Oliver -- 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-developers] Better Eclipse CDT support
Am 09.05.2011 23:32, schrieb Manuel Klimek: On Mon, May 9, 2011 at 2:30 PM, Manuel Klimek kli...@google.com wrote: On Sun, May 8, 2011 at 7:38 PM, Oliver Buchtala oliver.bucht...@jku.at wrote: Hi Alex, Manuel, and other interested watchers, I'd like to introduce a preview version of an Eclipse plugin 'CMakeWorkbench' which is combined with the CMake CDT7 generator developed lately. I try to reduce user actions for importing projects and managing working sets. By watching solution files generated with CDT7 generator automatic updating is achieved... Of course there are still some hitches... and obviously much space for improvement... but hey ;) that's is my first eclipse plugin Please find notes about installation: https://github.com/oliver/cmake-workbench/blob/master/doc/Install.markdown and a step by step HelloWorld on: https://github.com/oliver/cmake-workbench/blob/master/doc/examples/HelloWorld.markdown Please: I'd like to have your opinion and maybe some trying :) First impression: very nice. Somehow even the .h stuff works now :) No, it doesn't ... It now opens the projects in the background (which is nice) and had me thinking that there were no duplicated .cpp files in there any more for a moment. Yepp. This is still an issue. I filed issues on CDT and reopened the corresponding issue on my github. I hope I find a clean solution soon. Basically, I don't like my approach to have a link to the full tree. Causes trouble and brings redundancy. Hopefully, they (CDT gang) try to work on the Ctrl-Shift-R for includes. I will try to add more linked resources (e.g., flex input sources etc.) Linked folders raise so many problems right now :( Don't hesitate to add ideas, feelings, suggestions by means of issues or comments on my github :) Cheers, Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 06.05.2011 23:26, schrieb Alexander Neundorf: On Saturday 30 April 2011, Oliver Buchtala wrote: Am 30.04.2011 19:56, schrieb Oliver Buchtala: Am 30.04.2011 19:29, schrieb Alexander Neundorf: Nowadays, there are ways to deal better with that: linked folders, virtual folders and linked resources I'm not using Eclipse actively myself, I'm just maintaining the generator. But what people told me is that if the sources are not in a subdir of the project file, then the svn support of Eclipse does not work. Also if the sources are in a linked folder. Did this change ? Ok. Don't know. I have to check... Actually, there happened a lot around folders. Maybe this also works in the meantime. Nope. This is still not supported. My personal opinion is that I do not care about eclipse svn support. Other IDEs don't support this either (or not well). Also, in earlier days I have had not too good experiences with Subversive and Subclipse and always returned to doing svn from command line or other tools (e.g. TortoiseSVN). I looked a bit around in the internet and still find mainly bad remarks for those both plugins and suggestions not to do it from within Eclipse. When I look around my colleagues I find basically only positive remarks about the svn support in Eclipse ;-) This is also my impression from feedback from other users about the Eclipse generators, that the missing svn support in linked folders sucks. Alex Alright. Though, IMO SVN issues should not dominate CDT generation issues. But, you are totally right - this file system limitations in eclipse sucks... I consulted an eclipse guy these days... they are working on that and this is going to be better in e4 (=next generation)... For us, we have to be patient ;) Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 07.05.2011 00:02, schrieb Alexander Neundorf: On Friday 06 May 2011, Oliver Buchtala wrote: Am 06.05.2011 23:26, schrieb Alexander Neundorf: ... When I look around my colleagues I find basically only positive remarks about the svn support in Eclipse ;-) This is also my impression from feedback from other users about the Eclipse generators, that the missing svn support in linked folders sucks. Alex Alright. Though, IMO SVN issues should not dominate CDT generation issues. But, you are totally right - this file system limitations in eclipse sucks... I consulted an eclipse guy these days... they are working on that and this is going to be better in e4 (=next generation)... Ah. These two blog entries don't make it sound like a CDT for e4 will happen very soon ? http://cdtdoug.blogspot.com/2010/04/cdt-on-e4.html http://cdtdoug.blogspot.com/2010/06/im-not-anti-e4-im-just-busy-with- other.html Alex Hmmm. We have to be patient? ;) Nevertheless, the SVN problem might still be there, as it is also an issue with the SVN plugin impl... ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 30.04.2011 19:56, schrieb Oliver Buchtala: Am 30.04.2011 19:29, schrieb Alexander Neundorf: Nowadays, there are ways to deal better with that: linked folders, virtual folders and linked resources I'm not using Eclipse actively myself, I'm just maintaining the generator. But what people told me is that if the sources are not in a subdir of the project file, then the svn support of Eclipse does not work. Also if the sources are in a linked folder. Did this change ? Ok. Don't know. I have to check... Actually, there happened a lot around folders. Maybe this also works in the meantime. Nope. This is still not supported. My personal opinion is that I do not care about eclipse svn support. Other IDEs don't support this either (or not well). Also, in earlier days I have had not too good experiences with Subversive and Subclipse and always returned to doing svn from command line or other tools (e.g. TortoiseSVN). I looked a bit around in the internet and still find mainly bad remarks for those both plugins and suggestions not to do it from within Eclipse. Bye, Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 29.04.2011 20:49, schrieb Alexander Neundorf: On Friday 29 April 2011, Oliver Buchtala wrote: Am 29.04.2011 09:49, schrieb Eric Noulard: 2011/4/29 Oliver Buchtala oliver.bucht...@jku.at: As described before, I added links to the (main) project's source and build folder. You enable this with -DCDT_LINK_MAIN_SOURCE_FOLDERS=ON. For that to work properly, I strongly recommend to use Eclipse 3.7 M6 + CDT 8.0. @Alex: is there a way to provide --help assistance concerning such parameters with extra-generators? Hi guys, Just stepping in to say that documenting generator-specifics features is an issue CPack has as well. Read discussion on that topic here: http://public.kitware.com/Bug/view.php?id=10067 Currently I tried to put generator-specific doc. in CPackGenName.cmake file such that cmake --help-module CPackGenName will display the doc. the idea in the end would be to have cpack --help-generator GenName use the same mechanism to display the doc. may be we can design some unified way to documents such things for CMake/CPack/CTests. I know there are some (huge) bits of doc burried into the C++ code too but having a way to write some doc in separate files makes it easier to enhance the doc. Just throwing some ideas here. Hi Eric, thanks for your hint. I also vote for a unified approach. Personally, I think the doc for built-ins should reside in the source: no cluttering, and more uniqueness. But your suggestion is also reasonable. Would be awesome, if the doc could be taken from a comment block in the source file. Then it would be local and readable. But this is probably too difficult to achieve. All cmake docs are generated from the sources. There is a short doc for the generator, this is in cmExtraEclipseGenerator::GetDocumentation(). The variables are documented in cmDocumentVariables.cxx. The documentation for each module is at the top of the module itself. So if you put some documentation at the top of CMakeFindEclipseCDT4.cmake it will end up in the module documentation. Is this what you mean ? Alex Yep. Sounds great ;) ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 28.04.2011 22:57, schrieb Alexander Neundorf: On Wednesday 27 April 2011, Oliver Buchtala wrote: Forgot to feed the list... Am 27.04.2011 22:01, schrieb Alexander Neundorf: On Friday 22 April 2011, Oliver Buchtala wrote: ... Here we go: git://github.com/oliver/cmake_cdt7.git I have intensively worked with this generator the last days - and am not completely satisfied with it in the moment. But basically, it does what I want. I built and installed it. I'm actually not really using Eclipse much myself, e.g. so I have never used working sets before. I tried to load it via Project Explorer - Select Working Set - Window Working Set - Working set type: C/C++ and then selecting the builddir/eclipse/CMake.wst file. But now I'm not sure what to do with it. The normal targets and directory structure look like they did before, and in the eclipse/ directory there are a lot of empty directories starting with a @. So, how do I use it ? Alex Hi Alex, I have written down some things on http://edge.substance.io/#oliver/CMakeEclipseCDT7 I installed the plugin. Now I imported the working set CMake.wst instead of the project(s). I see three working sets: CMake, CMake/ALL and CMake/CTestDashboardTargets. When I select Top Level Elements - Projects, I see nothing from them. When I select Top Level Elements - Working sets, I see them, e.g. the CMake one. When I try to click it open, it is empty. If I right-click it and Go Into, the pane becomes empty. When I right-click and click Properties, it shows me a dialog with the existing (other) projects, no cmake among them, and no directories are checked. What am I doing wrong ? The wst file is attached. Alex Hi Alex, wst-file is allright and I see that all projects are generated :) Unfortunately, this working set stuff is yet a bit inconvenient, as it is not an Eclipse built-in. What you need to do: 0. Switch to C/C++ perspective (maybe this is the empty project observation you described?) 1. Import eclipse projects (all from the CDT_ECLIPSE_OUTPUT_DIR) - you see all projects flat side by side? 2. Import wst file 3. Goto 'Select Working Sets...' (in Project Explorer) 4. Select all (three) working sets 5. Goto 'Top Level Elements' (in Project Explorer) and activate 'Working Sets' Now you should see the projects within working sets Note1: almost all are in the CMake working sets, as FOLDERs are only set for MSVC generators Note2: once I experienced that the working sets plugin spoiled my workspace some how and I had import from scratch after deleting .metadata in workspace directory and restart eclipse and then redo that importing. Helps? I want to create an Eclipse Plugin which shall make all this more convenient and more automatically. Something like a CMake enabling 'Solution' file that manages imported projects and working sets etc... But yet I am a PDE beginner... so, this will take some more weeks... Bye, Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 29.04.2011 00:03, schrieb Oliver Buchtala: Am 28.04.2011 23:30, schrieb Oliver Buchtala: Am 28.04.2011 22:57, schrieb Alexander Neundorf: On Wednesday 27 April 2011, Oliver Buchtala wrote: Forgot to feed the list... Am 27.04.2011 22:01, schrieb Alexander Neundorf: On Friday 22 April 2011, Oliver Buchtala wrote: ... Here we go: git://github.com/oliver/cmake_cdt7.git I have intensively worked with this generator the last days - and am not completely satisfied with it in the moment. But basically, it does what I want. I built and installed it. I'm actually not really using Eclipse much myself, e.g. so I have never used working sets before. I tried to load it via Project Explorer - Select Working Set - Window Working Set - Working set type: C/C++ and then selecting the builddir/eclipse/CMake.wst file. But now I'm not sure what to do with it. The normal targets and directory structure look like they did before, and in the eclipse/ directory there are a lot of empty directories starting with a @. So, how do I use it ? Alex Hi Alex, I have written down some things on http://edge.substance.io/#oliver/CMakeEclipseCDT7 I installed the plugin. Now I imported the working set CMake.wst instead of the project(s). I see three working sets: CMake, CMake/ALL and CMake/CTestDashboardTargets. When I select Top Level Elements - Projects, I see nothing from them. When I select Top Level Elements - Working sets, I see them, e.g. the CMake one. When I try to click it open, it is empty. If I right-click it and Go Into, the pane becomes empty. When I right-click and click Properties, it shows me a dialog with the existing (other) projects, no cmake among them, and no directories are checked. What am I doing wrong ? The wst file is attached. Alex Hi Alex, wst-file is allright and I see that all projects are generated :) Unfortunately, this working set stuff is yet a bit inconvenient, as it is not an Eclipse built-in. What you need to do: 0. Switch to C/C++ perspective (maybe this is the empty project observation you described?) 1. Import eclipse projects (all from the CDT_ECLIPSE_OUTPUT_DIR) - you see all projects flat side by side? 2. Import wst file 3. Goto 'Select Working Sets...' (in Project Explorer) 4. Select all (three) working sets 5. Goto 'Top Level Elements' (in Project Explorer) and activate 'Working Sets' Now you should see the projects within working sets Note1: almost all are in the CMake working sets, as FOLDERs are only set for MSVC generators Note2: once I experienced that the working sets plugin spoiled my workspace some how and I had import from scratch after deleting .metadata in workspace directory and restart eclipse and then redo that importing. Helps? I want to create an Eclipse Plugin which shall make all this more convenient and more automatically. Something like a CMake enabling 'Solution' file that manages imported projects and working sets etc... But yet I am a PDE beginner... so, this will take some more weeks... Bye, Oliver FYI: I am currently struggling a bit with Eclipse's linked folders under Eclipse 3.6 + CDT 7.0.2. This has the consequence, that I can not add a link to PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR without causing troubles with the CDT indexer. I'd really like to have a the global project similar to the project your generator creates. With Eclipse 3.7 and CDT 8 these problems seem to be resolved. So that feature is currently deactivated and I will make it switchable for edge-affine eclipse users. When the next version is released officially it's gonna be the default behavior. Bye, Oliver As described before, I added links to the (main) project's source and build folder. You enable this with -DCDT_LINK_MAIN_SOURCE_FOLDERS=ON. For that to work properly, I strongly recommend to use Eclipse 3.7 M6 + CDT 8.0. @Alex: is there a way to provide --help assistance concerning such parameters with extra-generators? Bye, Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 27.04.2011 21:28, schrieb Alexander Neundorf: On Monday 25 April 2011, Oliver Buchtala wrote: Am 20.04.2011 22:09, schrieb Alexander Neundorf: ... What would you expect there ? Some structure that gives me acces to the sources of the targets. I suppose, you try to achieve this with sub-projects, but it does not work properly in my case. How does it work not properly ? Don't you have project() calls or are they not created ? While creating a document on my generator implementation, I stumbled over the solution to this problem. [Subprojects] was empty in my setting because the generated link specifications have been invalid. Maybe, Eclipse CDT has changed here (?). You have to use 'locationURI' for virtual folders and 'location' for linked folders. I.e., specify a linked folder like that (in .cproject-file): ... linkedResources link name[Subprojects]/name type2/type locationURIvirtual:/virtual/locationURI /link link name[Subprojects]/LIBCURL/name type2/type locationD:/libraries/cmake-git/Utilities/cmcurl/location /link /linkedResources ... Does the attached patch fix this for you ? For me (Eclipse Helios under Linux) it doesn't make a difference. Alex Yep. This does under Windows as well. Bye, Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 20.04.2011 22:09, schrieb Alexander Neundorf: ... What would you expect there ? Some structure that gives me acces to the sources of the targets. I suppose, you try to achieve this with sub-projects, but it does not work properly in my case. How does it work not properly ? Don't you have project() calls or are they not created ? While creating a document on my generator implementation, I stumbled over the solution to this problem. [Subprojects] was empty in my setting because the generated link specifications have been invalid. Maybe, Eclipse CDT has changed here (?). You have to use 'locationURI' for virtual folders and 'location' for linked folders. I.e., specify a linked folder like that (in .cproject-file): ... linkedResources link name[Subprojects]/name type2/type locationURIvirtual:/virtual/locationURI /link link name[Subprojects]/LIBCURL/name type2/type locationD:/libraries/cmake-git/Utilities/cmcurl/location /link /linkedResources ... ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Better Eclipse CDT support
Am 20.04.2011 22:09, schrieb Alexander Neundorf: On Wednesday 20 April 2011, Oliver Buchtala wrote: Hi Alex, ... What would you expect there ? Some structure that gives me acces to the sources of the targets. I suppose, you try to achieve this with sub-projects, but it does not work properly in my case. How does it work not properly ? Don't you have project() calls or are they not created ? There is some link - but empty. I have exactly one project call (like I usually do). Is your build dir a subdir of the source dir ? Yes. In this case the link to CMAKE_SOURCE_DIR is not generated, otherwise there should be a link [Source directory]. It's a pity that Eclipse has such problems with out-of-source builds. Ok - that is the problem with my setting then. It's really Eclipse which would need some fixing here. It would just have to accept that the base source directory is not always the directory where the project file is located, but can be a directory specified in the project file. This would help a lot. See attachment: 2.4.8 CDT4 MinGW generator on CMake/Example, Eclipse Helios, CDT 7.0.2 All in all, this is not what a developer used to CDT wants to see ;) What I want to do: - generate projects for each target (like in VC generators) Can you please explain ? Do you want a separate build tree for each project ? Or just separate Eclipse project files for each target ? For each target. Like in MSVC. Are you sure people will want to import that many projects or can they be grouped in some way in a superproject ? Eclipse users are used to a flat multi-project layout. They use working sets to group projects. Actually, I am personally not the greatest friend of complete flat hierarchies - but this is actually the eclipse way. You may have a look at large Eclipse java projects, e.g. Eclipse itself. Importing all projects in a directory is a one-clicker. Though, they should not be nested for that feature to work. Hmm. So this would be one build tree (i.e. one CMakeCache.txt with a global Makefile-structure), and Eclipse-projects for each target, and a working set which groups these projects together ? Yep. One Make tree. And 'light-weight' eclipse projects as views on targets. Don't know. Maybe. Can you provide a screenshot of how this looks like ? Or maybe create a clone of the cmake git tree on gitorious or github and try to implement it there ? I have a working impl will push it on github tommorrow :) Cool :-) Here we go: git://github.com/oliver/cmake_cdt7.git I have intensively worked with this generator the last days - and am not completely satisfied with it in the moment. But basically, it does what I want. I did not completely base upon your implementation (generating project programmatically) but rather used a template approach. The templates are created manually from within eclipse... I'll try to improve my work a bit the next days... Or, how about instead of creating one project per target one project per project() call ? Hmm. Is it typical to have many project calls? I don't know whether it's typical. It also depends what you consider many ;-) I usually use project() for a somehow self-contained part of the build tree. I'll ping you tomorrow (after work). I won't be back before Monday. Alex Alright. Frohes Osterfest then ;) Bye, Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [CMake] Post-Build commands on custom targets are always executed?
Am 19.04.2011 16:10, schrieb David Cole: On Mon, Apr 18, 2011 at 11:22 PM, Michael Hertling mhertl...@online.de mailto:mhertl...@online.de wrote: On 04/19/2011 02:17 AM, Oliver Buchtala wrote: Am 18.04.2011 06:58, schrieb Michael Hertling: On 04/16/2011 12:05 AM, Oliver Buchtala wrote: Am 15.04.2011 23:48, schrieb Michael Hertling: On 04/15/2011 11:22 PM, Oliver Buchtala wrote: Hi, I observe that a custom command attached to a custom target as POST-BUILD is launched on every build. Is that true? or is it a misconfiguration on my side? Bye, Oliver A custom target is always out of date, i.e. it is always rebuilt when it is visited - as a prerequisite of another target or due to the ALL clause, e.g., and since the target has been rebuilt, each associated POST_BUILD custom command is rerun. Thus, the behaviour you observed is correct, expected and reasonable, IMO. Regards, Michael Yep. That's reasonable. Do have a suggestion how to get around a rerun of the post-build? Prevent the custom target from being visited, i.e. from being checked if it's up to date since it will be found to be out of date, so the immediately associated commands - if any - are run as well as the associated POST_BUILD custom commands. Or how would you do a post-build after custom-target without being run when custom-target actually did nothing, What do you mean with a custom target that actually did nothing? Not visited or no own commands? In the former case, the associated custom commands are not run, of course, but in the latter case, it does not matter if there are immediately associated commands or not since the target will be considered as out of date and rebuilt-without-op, and its POST_BUILD custom commands will be run. In other words: A custom target - even without own commands - is not good for preventing its custom commands from being run when the custom target is visited. i.e., custom target depends on custom command that did nothing? The same holds for this kind of dependency, i.e. the visited custom target will be rebuilt regardless whether the prerequisite custom command did do something or not, or do you still talk about the custom-command-associated-with-custom-target dependency? Alright. Then, no way to get what i want with custom targets. I am asking, as I try to improve behavior with UseJave.cmake::add_jar (on stage::next) which creates a custom target. E.g., after building the jar I want to copy the java archive into another destination (not install). OK, I see; in fact, this would be a good job for a POST_BUILD custom command associated with the custom target. Thus, as you can't prevent the custom command from being run on behalf of the custom target, you should set up the command to do nothing if there's actually nothing to do. E.g., you might use ${CMAKE_COMMAND} -E copy_if_different ... to copy the updated-or-not-updated jar file, so the custom command is as cheap as possible, although it always runs when the custom target is examined. Moreover, ${CMAKE_COMMAND} -P ... and the IF() command's EXISTS and IS_NEWER_THAN clauses possibly provide further approaches w.r.t. your concern. Regards, Michael As long as java support is on a weak basis (i.e., not built-in), this won't change... Thank you for your help! Bye, Oliver ___ Powered by www.kitware.com http://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 This is how I would do it: Why wouldn't you simply add *another* custom target that depends on the output of a custom command, and then make that custom command's output be your copy of the jar file, and then make the custom command depend on the real jar file? Then, the custom target would run always -- but it has no command, so there's never anything to do, but when the custom command's depends are out of date, it will execute, and the jar file will be copied... If you have something that depends on a file, then it should nearly always be a custom command. Custom targets are best at simply collecting related custom commands in. I've never found them that useful with commands associated directly in the add_custom_target call. HTH, David
Re: [CMake] Post-Build commands on custom targets are always executed?
Am 18.04.2011 06:58, schrieb Michael Hertling: On 04/16/2011 12:05 AM, Oliver Buchtala wrote: Am 15.04.2011 23:48, schrieb Michael Hertling: On 04/15/2011 11:22 PM, Oliver Buchtala wrote: Hi, I observe that a custom command attached to a custom target as POST-BUILD is launched on every build. Is that true? or is it a misconfiguration on my side? Bye, Oliver A custom target is always out of date, i.e. it is always rebuilt when it is visited - as a prerequisite of another target or due to the ALL clause, e.g., and since the target has been rebuilt, each associated POST_BUILD custom command is rerun. Thus, the behaviour you observed is correct, expected and reasonable, IMO. Regards, Michael Yep. That's reasonable. Do have a suggestion how to get around a rerun of the post-build? Prevent the custom target from being visited, i.e. from being checked if it's up to date since it will be found to be out of date, so the immediately associated commands - if any - are run as well as the associated POST_BUILD custom commands. Or how would you do a post-build after custom-target without being run when custom-target actually did nothing, What do you mean with a custom target that actually did nothing? Not visited or no own commands? In the former case, the associated custom commands are not run, of course, but in the latter case, it does not matter if there are immediately associated commands or not since the target will be considered as out of date and rebuilt-without-op, and its POST_BUILD custom commands will be run. In other words: A custom target - even without own commands - is not good for preventing its custom commands from being run when the custom target is visited. i.e., custom target depends on custom command that did nothing? The same holds for this kind of dependency, i.e. the visited custom target will be rebuilt regardless whether the prerequisite custom command did do something or not, or do you still talk about the custom-command-associated-with-custom-target dependency? Alright. Then, no way to get what i want with custom targets. I am asking, as I try to improve behavior with UseJave.cmake::add_jar (on stage::next) which creates a custom target. E.g., after building the jar I want to copy the java archive into another destination (not install). As long as java support is on a weak basis (i.e., not built-in), this won't change... Thank you for your help! Bye, Oliver ___ 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-developers] Better Eclipse CDT support
Hi Alex, Am 17.04.2011 20:46, schrieb Alexander Neundorf: Hi, On Sunday 17 April 2011, Oliver Buchtala wrote: Hi, I like to get involved offering work on the Eclipse CDT generator. Currently, the generated project setting is not very Eclipse'ish. There have been some changes in the 2.8.x versions. You have 2.8.4 ? Yes. Actually current 'next' of stage. - one large project - linear build, i.e., build failure in early sub projects stops the whole chain You can change this e.g. by adding -k as CMAKE_ECLIPSE_MAKE_ARGUMENTS in the cmake cache. What does '-k' do? - project overview looks like navigator on cmake binary directory - source files can be found in 'includes' Can you please explain the two points above in more detail ? When I generate a CDT project, sources are in 'includes' (CDT built-in folder). The rest is the content of CMAKE_BINARY_DIR. See attachment: 2.4.8 CDT4 MinGW generator on CMake/Example, Eclipse Helios, CDT 7.0.2 typo: 2.8.4 All in all, this is not what a developer used to CDT wants to see ;) What I want to do: - generate projects for each target (like in VC generators) Can you please explain ? Do you want a separate build tree for each project ? Or just separate Eclipse project files for each target ? For each target. Like in MSVC. Are you sure people will want to import that many projects or can they be grouped in some way in a superproject ? Eclipse users are used to a flat multi-project layout. They use working sets to group projects. Actually, I am personally not the greatest friend of complete flat hierarchies - but this is actually the eclipse way. You may have a look at large Eclipse java projects, e.g. Eclipse itself. Importing all projects in a directory is a one-clicker. Though, they should not be nested for that feature to work. Another typical way to separate things is to have multiple workspaces. E.g. one for each large project. So IMO there are enough ways to structure views on very large projects. Another feedback story: At work, I suggested my coworkers to give eclipse+cmake a try (without trying it myself) as we have now a CMake setup and I am a fan of CDT. They stopped disappointed beeing confused by the project layout. They are used to MSVC and a bit to Codeblocks. And, trying it the first time (yesterday) I really felt similar. Perhaps, you can understand on the basis of my screenshot. - based upon makefile generator eclipse cdt projects can be based upon existing makefiles (e.g. in sub-dirs) - add folders: * src: using eclipse linked folder pointing to source location (CMAKE_CURRENT_SOURCE_DIR) * cmake: eclipse linked folder pointing to CMAKE_CURRENT_BINARY_DIR We have something like this in 2.8.4. I.e. there are linked folders for each project(), and one linked folder for CMAKE_SOURCE_DIR. I thought have seen this beeing deactivated in source code due to some issue filed on bugtracker? - add project dependencies for correct build order Having this would make the CDT generator beeing a serious citizen on the cmake generators list. Q's: - What is your opinion? A not-Makefile based native Eclipse project generator might also be an alternative, but requires more work. I think the Makefile based approach is very reasonable as it is really tightly integrated. Actually, there is not too much missing IMO. Per target project would bring a more intuitive relation between targets and projects. This is really what I want from the IDE setting. Otherwise I will use make on the shell. I would add a project per target based on make. Per project add only the one make target. And maybe add a global ALL project. Maybe also a ZERO_CHECK project all others depend on ... for checking on CMakeLists.txt changes. Another question: you call the generator CDT4. Current CDT is 7.0.2. Though, I find 'cdtBuilder version' in current .cproject. Is CDT4 'out-of-date' or are you referring to the version in xml? Ehmm, I mean this: ?fileVersion 4.0.0? storageModule moduleId=cdtBuildSystem version=4.0.0 Bye, Oliver ___ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
[CMake] Post-Build commands on custom targets are always executed?
Hi, I observe that a custom command attached to a custom target as POST-BUILD is launched on every build. Is that true? or is it a misconfiguration on my side? Bye, Oliver ___ 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] Post-Build commands on custom targets are always executed?
Am 15.04.2011 23:48, schrieb Michael Hertling: On 04/15/2011 11:22 PM, Oliver Buchtala wrote: Hi, I observe that a custom command attached to a custom target as POST-BUILD is launched on every build. Is that true? or is it a misconfiguration on my side? Bye, Oliver A custom target is always out of date, i.e. it is always rebuilt when it is visited - as a prerequisite of another target or due to the ALL clause, e.g., and since the target has been rebuilt, each associated POST_BUILD custom command is rerun. Thus, the behaviour you observed is correct, expected and reasonable, IMO. Regards, 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 Yep. That's reasonable. Do have a suggestion how to get around a rerun of the post-build? Or how would you do a post-build after custom-target without being run when custom-target actually did nothing, i.e., custom target depends on custom command that did nothing? Bye, Oliver ___ 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 Win-Registry search in UseJNI.cmake
Hello, I am working with CMake 2.8 and using UseJNI.cmake I have a JDK installed locally (registered in Win-Registry) but want to configure a project to use a different JDK lying on my disk. Looking at UseJNI.cmake I find that the environment variable JAVA_HOME could be handy, but unfortunately UseJNI prefers the Windows-Registry entries above all other search paths. Did I miss something? Shall I file an issue? Oliver ___ 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 Win-Registry search in UseJNI.cmake
Am 05.04.2011 13:12, schrieb Oliver Buchtala: Hello, I am working with CMake 2.8 and using UseJNI.cmake I have a JDK installed locally (registered in Win-Registry) but want to configure a project to use a different JDK lying on my disk. Looking at UseJNI.cmake I find that the environment variable JAVA_HOME could be handy, but unfortunately UseJNI prefers the Windows-Registry entries above all other search paths. Did I miss something? Shall I file an issue? Oliver Sorry, the macro file is called FindJNI.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] Overriding Win-Registry search in UseJNI.cmake
Am 05.04.2011 16:33, schrieb David Cole: On Tue, Apr 5, 2011 at 7:16 AM, Oliver Buchtala oliver.bucht...@jku.at mailto:oliver.bucht...@jku.at wrote: Am 05.04.2011 13:12, schrieb Oliver Buchtala: Hello, I am working with CMake 2.8 and using UseJNI.cmake I have a JDK installed locally (registered in Win-Registry) but want to configure a project to use a different JDK lying on my disk. Looking at UseJNI.cmake I find that the environment variable JAVA_HOME could be handy, but unfortunately UseJNI prefers the Windows-Registry entries above all other search paths. Did I miss something? Shall I file an issue? Oliver Sorry, the macro file is called FindJNI.cmake. ___ Powered by www.kitware.com http://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 The only find_* calls I see in FindJNI.cmake are: FIND_LIBRARY(JAVA_AWT_LIBRARY jawt FIND_LIBRARY(JAVA_JVM_LIBRARY NAMES jvm JavaVM FIND_PATH(JAVA_INCLUDE_PATH jni.h FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h If you want to override the default locations to find a specific installation of java stuff, just set those variables in your cache to point to the right stuff before calling find_package(JNI). For example: set(JAVA_AWT_LIBRARY /full/path/to/libjawt.a CACHE FILEPATH jawt library) find_package(JNI) If a variable is already set before calling a find_* command, then the find is a no-op and it trusts that you've set it correctly. HTH, David Hi David, ok. I thought it could even be easier ;) If I disable the win-Registry lookup stuff and set JAVA_HOME appropriately then everything is found perfectly. And if disabling would be just changing the order of search paths this would be more control for me and still powerful (i.e., when not using JAVA_HOME). Nevertheless, I can also live with your suggestion... Thank you, Oliver ___ 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 Win-Registry search in UseJNI.cmake
Am 05.04.2011 17:11, schrieb Oliver Buchtala: Am 05.04.2011 16:33, schrieb David Cole: On Tue, Apr 5, 2011 at 7:16 AM, Oliver Buchtala oliver.bucht...@jku.at mailto:oliver.bucht...@jku.at wrote: Am 05.04.2011 13:12, schrieb Oliver Buchtala: Hello, I am working with CMake 2.8 and using UseJNI.cmake I have a JDK installed locally (registered in Win-Registry) but want to configure a project to use a different JDK lying on my disk. Looking at UseJNI.cmake I find that the environment variable JAVA_HOME could be handy, but unfortunately UseJNI prefers the Windows-Registry entries above all other search paths. Did I miss something? Shall I file an issue? Oliver Sorry, the macro file is called FindJNI.cmake. ___ Powered by www.kitware.com http://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 The only find_* calls I see in FindJNI.cmake are: FIND_LIBRARY(JAVA_AWT_LIBRARY jawt FIND_LIBRARY(JAVA_JVM_LIBRARY NAMES jvm JavaVM FIND_PATH(JAVA_INCLUDE_PATH jni.h FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h If you want to override the default locations to find a specific installation of java stuff, just set those variables in your cache to point to the right stuff before calling find_package(JNI). For example: set(JAVA_AWT_LIBRARY /full/path/to/libjawt.a CACHE FILEPATH jawt library) find_package(JNI) If a variable is already set before calling a find_* command, then the find is a no-op and it trusts that you've set it correctly. HTH, David Hi David, ok. I thought it could even be easier ;) If I disable the win-Registry lookup stuff and set JAVA_HOME appropriately then everything is found perfectly. And if disabling would be just changing the order of search paths this would be more control for me and still powerful (i.e., when not using JAVA_HOME). Nevertheless, I can also live with your suggestion... Thank you, Oliver Hi David, Thinking it over again, I am getting to like it less... Setting these variables is in fact the stuff that FindJNI does. For now I will live with a monkey patched version that allows disabling the registry search stuff. Is this an option for the core FindJNI.cmake too - i.e., introducing a means to disable win registry search? Bye, Oliver ___ 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] Outputting VS projects under Linux
Is it possible to create visual studio/msbuild projects under Linux? (It would ease the flow of our automation chain, and it'd be handy for working with MonoDevelop). - Oliver ___ 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 USE_FOLDERS correctly?
Hello, I have problems using the project folder feature described in the documentation for CMake 2.8.4 (http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_global:USE_FOLDERS) The very first command in my configuration is set(GLOBAL PROPERTY USE_FOLDERS ON) later, I define target properties, as so set_property(TARGET myCore PROPERTY FOLDER Core) I am using cmake --version cmake version 2.8.4 under Windows with generator 'Visual Studio 9 2008'. I am working with a VS Professional version (not Express). Everything is generated without errors or warnings, but the generated solution does not contain anything like solution folders. What could be my problem? Bye, Oliver ___ 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 USE_FOLDERS correctly?
Am 18.03.2011 18:31, schrieb Robert Bielik: Hi Oliver, I use this feature and only thing that differs for me is that I do: SET_TARGET_PROPERTIES( myCore PROPERTIES FOLDER Core ) Hope that helps, /Rob ___ 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 Hi Rob, I tried this as well - unfortunately does not help. But thanks anyway Bye, Oliver ___ 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 USE_FOLDERS correctly?
Am 18.03.2011 18:51, schrieb David Cole: On Fri, Mar 18, 2011 at 1:15 PM, Oliver Buchtala oliver.bucht...@jku.at wrote: Hello, I have problems using the project folder feature described in the documentation for CMake 2.8.4 (http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_global:USE_FOLDERS) The very first command in my configuration is set(GLOBAL PROPERTY USE_FOLDERS ON) Typo... you mean: set_property(GLOBAL PROPERTY USE_FOLDERS ON) (You're setting a CMake variable named GLOBAL there, not a global property...) Cheers, David Hi David, that's it! Thanks, Oliver ___ 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] header files with visual studio
Michael Jackson said the following on 11/15/2010 11:56 AM: Ahh. It is a bit clearer the tract you are taking. What I am suggesting is that you only have to run the scanner once and keep the results in CMake syntax files so that CMake can just simply re-use the list. As you add headers during development you can add headers to the lists that were generated. It is the first big lump of headers which is the daunting task. After that general maintenance of the CMake files is simple and straight forward. For example in the folder: +- Solution | +- Target 1 | | +- Sources | | +- Headers you can have a file Headers.cmake which contains set (TARGET_1_HEADERS foo.h bar.h other.h) which can be generated once by a script. And in the CMakelists.txt file for Target 1 you can have: include (Headers/Headers.cmake) It's not nearly that simple; Target1 might be the login server, which uses header files from login/, chat/, etc, etc, etc. And these dependencies change frequently. The primary purpose is not to provide an SCM list of header files, but an active dependency list of header files so that IDE functions like search this target only work. Our source layout has many modules, but module != target. Any given target will have both source and header files from numerous modules/folders. Sure, everytime we alter the #Include chain we're going to have to rebuild the project files from the CMakeLists, but with per-target dependency-generated header lists ... It becomes worth it. - Oliver ___ 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] header files with visual studio
Eric Noulard said the following on 11/11/2010 5:53 AM: Having a lot of source code re-use from source modules that can be shared between several projects is off course a necessary goal when your source code base grows and the set of projects using those goes along the same curve. My experience is in this case you may have mainly two kinds of re-use: A) external-like re-use were the reused module is an autonomous [set of] library and executable. CMake may handle this using ExternalProject_Add module and the module may have his own CMakeLists.txt containing the toplevel PROJECT(...) B) internal-like re-use. You may import the source but the imported source may not be compiled autonomously and should be plugged somewhere in the project source tree using the module. In this case ecah internal-like module may be shipped with a SourceDescription.cmake file which (manually) define appropriate set of CMake VAR (MODULE_SRC_FILES,MODULE_HEADER_FILES, ...) which can be included by the upper-level using project. A-type project are edited (and source-controlled) on their own. B-type project may be edited in any user project, how you handle source control in this case depends on your organisation and project inter-dependency management. What I was hoping to achieve was a Header Files folder along side each Source Files folder so that the headers were pertinent to any given project within a solution. Does CMake source_group will do the jobs if each sub-project is defining its list ofMODULE_KIND_FILES? Now, I admit I'm not a usual Visual Studio user so you are pretty right with the fact I didn't face any performance issue on big project with VS. I did work on relatively big source project with many imported modules (external-like or internal-like) but we were not using any IDE just emacs/vi etc and a big set of Makefiles (no CMake usage at that time). I mostly work with emacs/vi and - prior to CMake - Makefiles. I'm still mostly working with emacs/vi, but I also do a fair amount of work with Visual Studio and CodeBlocks, primarily when I need to test client interactions with server processes. Manually maintaining duplicated lists of #includes is data duplication: Like manually maintaining dependency lists. If we had to do that with CMake, well I doubt we'd be having this conversation in the first place because we probably wouldn't be /using/ CMake. So I don't understand why you would feel differently about having those lists automatically transcribed to the resultant IDE solution/project files. - Oliver ___ 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] header files with visual studio
Michael Hertling said the following on 11/11/2010 5:23 AM: Clearly, the downside is the usage of an external dependency scanner. Yep, but radically better than having to try and manually duplicate/recreate/maintain the dependency list :) Thank you for your posts :) - Oliver ___ 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] header files with visual studio
Eric Noulard said the following on 11/6/2010 6:20 AM: Initially it may be a pain to list them but after a while its generally better to manually keep track of file (dis)appearing in your source tree. (which is usually what you do when using an IDE without CMake) I.e. if those files are/were added by hand into the build system then they must but tracked by explicit list in CMakeLists.txt. The only case (I see) you may faithfully glob for *.h *.whatever is when those are generated files. Not doing that means I don't care about source file which are added/removed I just want to compile those **MY** opinion is that this way of looking to source code is wrong. You appear to be confusing Revision Control / Asset Management with source code editing. And while for smaller projects that may make some sense, it breaks very quickly as the project size scales up. The solution file for (just) our server systems has 21 top-level projects (not counting ALL_BUILD, INSTALL and ZERO_CHECK). Because of the high degree of code reuse and overlap, all of the host, client and miscellaneous source codes sit side-by-side (although not in any one single directory). So importing */*.{h,hh,hpp} into the CMakeLists file is nonsensical. What I was hoping to achieve was a Header Files folder along side each Source Files folder so that the headers were pertinent to any given project within a solution. http://www.kfs.org/~oliver/solution.jpg ___ 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] header files with visual studio
Michael Hertling said the following on 11/6/2010 7:39 AM: stored in the ${CMAKE_BINARY_DIR}/filelist.dat script as an assignment to the variable FILELIST. Subsequently, this filelist.dat is read via INCLUDE(), so CMake keeps track of it, i.e. changing the filelist.dat results in a rebuild. Finally, the filelist custom target regenerates filelist.dat by executing filelist.cmake. Hence, each time the set of *.c files in CMAKE_SOURCE_DIR changes, a make filelist will update filelist.dat, and the following make will rebuild - taking into account the refreshed list of source files. Maybe, this approach can be adapted to platforms other than *nix and large projects. I already have the source files split up into their myriad sub-projects, all I really want is to tap into the dependency generator to get a list of header files pertinent to any given project. In particular, this is useful for performing search operations. Remember: Visual Studio allows you to constrain multi-file searches a number of ways, one of which is Just this project. When you have thousands of header files, having every header in your codebase arbitrarily crammed into your project file means that every project-only search is going to return too many results. ___ 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] header files with visual studio
Michael Jackson said the following on 11/4/2010 12:34 PM: Like, others have stated: You MUST include them in the add_executable or add_library call. The macro I give above can help keep those files organized in the Project/Solution file if you want the organization to mimic the file system for instance. Otherwise CMake will create the project will all the files in a single Source folder. HTH Thanks for the detailed response, Michael :) I guess I wasn't quite clear enough in the OP, I was really hoping it could be done automatically, perhaps through the dependency generator. Our project is fairly complex (it's a distributed client-server-server system with multiple distributed server processes each with their own project). A little over 5000 header files. And, never mind lines of code, there are 108,425 #include statements in our source tree. So, the question is actually: Is there a way to have CMake automatically add included headers to visual studio project files or do you need to use a dependency system to generate the lists by hand? - Oliver ___ 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] header files with visual studio
Checked the faq and googled as much as I could but I couldn't find anything describing how to make visual studio include header files in the solution/project files? - Oliver ___ 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] Is there really any cmake support?
On 3/28/2010 5:14 AM, Fred Fred wrote: This list seems not to be really active and I did not receive any help since I posted this one week ago. BTW this issue has been open on Mantis more than 3 months ago and seems still to be open! So is there really anybody trying to help on cmake?? If the developers were out monitoring every bug-reporting list in the universe (such as ITK), there probably wouldn't be any support. To answer your question: yes you should post it to the CMake bug reporting tool if you want the CMake people to know about it. If the bug is that mission critical to you, there is always the option of downloading the source, fixing the bug, and submitting a patch to the CMake developers. Otherwise - I'd love to know what significantly-cross-platform open source projects you've been working on where bug fixes have such a rapid turnaround. I've seen fairly critical bug tickets for Ubuntu, GDM, Firefox, Thunderbird, OpenOffice and GCC for years. MySQL has had several fatal crash bugs open for 2+ years, and their response to a major bug introduced by Prepared Statements was, after a year of people complaining about it, to remove the default auto-connection behavior to sort of make it go away. Thus far, I've gotten better support out of the CMake developers than I have from several commercial software providers, including Intel. - Oliver ___ 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] ICC under Linux
When you tell CMake under Linux to use ICC, there's no automatic detection of the custom archiver and linker that ICC requires. The following lines fix that, but would it be possible to add them to the stock CMake files someplace so that using ICC becomes slightly more transparent? # Intel(R) Compiler has its own library archiver, # if you build libraries and do not use xiar, # the Intel compiler will complain about invalid # archives at the link phase. # The Intel(R) archiver is xiar usually # located in the same folder as the compiler, # /opt/intel/Compiler/nn/n.nn/ia32/bin/xiar # for example. FIND_PROGRAM(XIAR xiar) IF(XIAR) SET(CMAKE_AR ${XIAR}) ENDIF(XIAR) MARK_AS_ADVANCED(XIAR) # Intel(R) Compiler also comes with its own linker # which provides a number of additional benefits when # linking code compiled with the Intel(R) compiler. # Again, usually in the same place as icc itself, # /opt/intel/COmpiler/nn/n.nn/ia32/bin/xild per e.g FIND_PROGRAM(XILD xild) IF(XILD) SET(CMAKE_LINKER ${XILD}) ENDIF(XILD) MARK_AS_ADVANCED(XILD) ___ 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] This has to have been asked before...
Michael Wild said the following on 3/8/2010 1:35 PM: What I did is define custom functions that wrap add_executable, add_library and target_link_libraries. Works like a charm ;-) *DUH!* Thank you :) - Oliver ___ 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] This has to have been asked before...
I'm probably not using the right keywords on my search. I want to add a target (a gcc precompiled header) as a dependency for every target so it'll get compiled with the flags for that particular target, including altering the resulting file name. I did try looking at the precompiled header CMake include, but that just confused the bejeezus out of me, not helped by the fact that it didn't work :) - Oliver ___ 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] This has to have been asked before...
On 3/6/2010 6:39 PM, Oliver Smith wrote: I want to add a target (a gcc precompiled header) as a dependency for every target so it'll get compiled with the flags for that particular target, including altering the resulting file name. I should say: /automatically/ add... I don't want to add them by hand :) (Project has a lot of targets =/) - Oliver ___ 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] Adding a generated source to all multiple targets
David Cole said the following on 2/24/2010 1:25 AM: Or this: http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F Bizzare. That's where I started. I rolled out all of my changes, stepped through recreating them based on the faq again, and this time it works... I did an svn diff, none found... That's half the problem solved -- the bulk of the post was, though: I want to automatically generate one of these per-target, so that the tolua runs with per-target compiler switches, and so that the resulting .cc file is compiled with the per-target compile flags plus any specific flags needed to compile that source. I.e. the origin file is lua.pkg; For target dbproxy I want to run tolua++ -n game ${db_proxy_definitions} ${common_definitions} -o ${Foo_BINARY_DIR}/lua.dbproxy.cc ${Foo_SOURCE_DIR}/lua.pkg For target statsd I want to run tolua++ -n game ${statsd_definitions} ${common_definitions} -o ${Foo_BINARY_DIR}/lua.statsd.cc ${Foo_SOURCE_DIR}/lua.pkg And to add those .cc files to their respective targets. Obviously I can do it by hand, duh, but I have a lot of targets, so before I do go add it one at a time, I just want to be sure I'm not missing some mechanism for saying add a variation of this to all targets or add a variation of this to this list of targets. - Oliver ___ 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] Adding a generated source to all multiple targets
Tyler Roscoe said the following on 2/24/2010 6:50 PM: I would write a wrapper for add_library() and/or add_executable() that does the normal add_*() stuff and then also sets up the custom command for generating the lua.*.cc files. Ok - I just wanted to make sure there wasn't some built-in way of doing it before I plowed ahead with that :) I.e. the origin file is lua.pkg; For target dbproxy I want to run tolua++ -n game ${db_proxy_definitions} ${common_definitions} -o ${Foo_BINARY_DIR}/lua.dbproxy.cc ${Foo_SOURCE_DIR}/lua.pkg For target statsd I want to run tolua++ -n game ${statsd_definitions} ${common_definitions} -o ${Foo_BINARY_DIR}/lua.statsd.cc ${Foo_SOURCE_DIR}/lua.pkg If these are real examples from your code, I would strongly suggest normalizing your variable names. If the target is called dbproxy then Hehe, no, it's not :) And I didn't make it clear where I was just using ${...} to denote stuff from another place :) making all the config variables for that target match the form dbproxy_WHATEVER lets you say stuff like: add_library(${this_target} ${${this_target}_SOURCE_FILES} ...) Hmm - I didn't know you could do that, so I've been doing everything project relative, but then the size of this project and the number of sub-targets, and the huge amount of shared code between targets means that things aren't really organized by target, so all of the targets sit in one top-level project. - Oliver ___ 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] Adding a generated source to all multiple targets
I have a CMake project with a number of targets, and a Lua wrapper generated through tolua++ which is included by several of them, so that it is compiled with the target-specific make flags per-target. Global make flags: -O0 -ggdb3 -Wall -Werror ... etc Target1 make flags: -DAS_DB_PROXY ... Target2 make flags: -DAS_GAME_SERVER ... Target3 make flags: -DAS_CLIENT etc - there are 10 targets in total LuaTarget make flags: -Wno-unused The LuaTarget is luapkg.cc generated from lua.pkg via tolua++ -n game -o luapkg.cc luapkg.pkg If I add luapkg.cc to the list of sources for any given target, CMake barfs because luapkg.cc doesn't exist. I've tried variations of add_custom_target and add_custom_command to no avail. Is there a way to do this with CMake 2.6 or 2.8? And it occurs to me that if I can find a solution to this, I can probably use the same solution for adding a precompiled header to each target (for my limited subset of platforms). - Oliver ___ 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] Adding pre-compiled header support easily (add_generated_source)
COMPILE_DEFINITIONS PROJ_LIBRARY) # Client automatically gets src/luaWrapper.client.cc added and the precompiled header # built with PROJ_CLIENT defined instead of PROJ_LIBRARY add_target(client ${Project_SOURCE_DIR}/src/clientMain.cpp ${Project_SOURCE_DIR}/src/clientEngine.cpp ${Project_SOURCE_DIR}/src/common-depends.cpp ) set_property(TARGET client PROPERTY COMPILE_DEFINITIONS PROJ_CLIENT) target_link_libraries(common) # Server automatically gets src/luaWrapper.server.cc added and the precompiled header # built with PROJ_SERVER defined add_target(server ${Project_SOURCE_DIR}/src/serverMain.cpp ${Project_SOURCE_DIR}/src/serverEngine.cpp ${Project_SOURCE_DIR}/src/common-depends.cpp ${Project_SOURCE_DIR}/src/serverDatabase.cpp ) set_property(TARGET server PROPERTY COMPILE_DEFINITIONS PROJ_SERVER PROJ_DATABASE=${PROJ_DATABASE}) target_link_libraries(common ${DATABASE_LIBRARIES}) - Oliver ___ 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] Single-shot compilation
On systems that support it, I'm wanting to do the equivalent of: $(CC) -pipe source1.cpp source2.cpp source3.cpp -fwhole-program I can't figure out how to tell CMake to pass multiple sources to the compiler at once. (Using versions 2.6 and 2.8) - Oliver ___ 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] Cmake Solaris 10
Hello, i cant find any workaround for compiling cmake under solaris 10. I just saw threads or mails to the list regarding my problem compiling cmake on solaris 10 where there is the problem with the static linked library. (libcmsys.a) I´d be open for any solution. Regards Oliver -- Oliver Trebbe Department of Neurology University of Muenster 48129 Muenster, Germany ___ 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] FIND_LIBRARY not using CMAKE_FIND_LIBRARY_SUFFIXES
Hi, I am using Cygwin on Windows, using CMake 2.6.2. I was originally debugging FindBoost, when I narrowed the problem down to FIND_LIBRARY. This simple statement does not find the library: SET (CMAKE_FIND_LIBRARY_SUFFIXES .a) FIND_LIBRARY(NAMES test HINTS /usr/local/lib) However, this works: FIND_LIBRARY(NAMES test.a HINTS /usr/local/lib) Is this a known bug (that's only prevalent on Cygwin)? To solve my problem with FindBoost, I had to manually add in the .a into the FIND_LIBRARY command. Thanks, Oliver ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] link problem with cmake
On 10/5/08, Alexander Neundorf [EMAIL PROTECTED] wrote: On Sunday 05 October 2008, Oliver Dole wrote: Hello, I have a link problem with cmake on Linux. I work on owb, a webkit based browser, which uses cmake as build system. Here is how my cmake system works: - build balwtf.a, kjs.a and webcore.a - build libwebkit.so which requires balwtf.a, kjs.a and webcore.a - then I build owb. From my point of view to do a correct link on linux, I simply should do: g++ -c main.cpp.o -lwebkit -o owb Unfortunately, by default cmake transitively links to targets with which the library itself was linked. so my link is currently the following: g++ -c main.cpp.o -lwebkit -Wl,--whole-archive -lbalwtf -lkjs -lwebcore -o owb Does cmake support whole-archive now ? I didn't know that. kind of... I have done the followig ugly thing to make cmake support it: if(CMAKE_COMPILER_IS_GNUCXX) set(WEBKKIT_LD_FLAGS -Wl,-whole-archive -lbalwtf -lkjs -lwebcore -Wl,-no-whole-archive) endif(CMAKE_COMPILER_IS_GNUCXX) target_link_libraries(webkit-owb ${WEBKKIT_LD_FLAGS} ${EXTERNAL_DEPS_LIBRARIES} ) It seems that there is something to do with LINK_INTERFACE_LIBRARIES to remove the default behaviour, but I do not know what. So any help on how to archieve that is welcome. Please use at cmake = 2.6.2. Then specifiy the link interface of webkit, it's now done with a new argument to target_link_libraries(). target_link_libraries(webkit kjs balwtf webcore) target_link_libraries(webkit LINK_INTERFACE_LIBRARIES ) - makes the link interface empty. I hope I remember correctly, since I didn't test this right now. Thanks, after an update to cmake 2.6.2 it perfectly works. Alex Regards, ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Olivier DOLE Pleyo Software Engineer ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] link problem with cmake
Hello, I have a link problem with cmake on Linux. I work on owb, a webkit based browser, which uses cmake as build system. Here is how my cmake system works: - build balwtf.a, kjs.a and webcore.a - build libwebkit.so which requires balwtf.a, kjs.a and webcore.a - then I build owb. From my point of view to do a correct link on linux, I simply should do: g++ -c main.cpp.o -lwebkit -o owb Unfortunately, by default cmake transitively links to targets with which the library itself was linked. so my link is currently the following: g++ -c main.cpp.o -lwebkit -Wl,--whole-archive -lbalwtf -lkjs -lwebcore -o owb It seems that there is something to do with LINK_INTERFACE_LIBRARIES to remove the default behaviour, but I do not know what. So any help on how to archieve that is welcome. Regards, -- Olivier DOLE Pleyo Software Engineer ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] How to build a library divided in many directories ?
Hello, On 2/25/08, packadal [EMAIL PROTECTED] wrote: Hi, I searched for an answer to this question in vain, so I'm asking here. I am trying to build a library wich is spead among many subdirectories using CMake, but I can't seem to do it the Right Way. Looks like the right way to do this would be to write a CMakeLists.txt in each subdirectory, as this would be cleaner, and much more changes-friendly, but I can't seem to build only one library when I do it this way. example of my source tree : + src | - Application | - Attributes | - Audio . . . | - Utils Each directory containing multiple source files for the lib. I managed to build the library, putting each and every file in a single variable in one file, but this is looking quite ugly... So how should i do please ? Here is how I would proceed. First I assume that you compile all .c files in each sub directories, then I suppose you have many many files to compile. AUX_SOURCE_DIRECTORY (Applications APPLICATIONS_SRC) AUX_SOURCE_DIRECTORY (Attributes ATTRIBUTES_SRC) ... AUX_SOURCE_DIRECTORY (Utils UTILS_SRC) LIST (APPEND FULL_SRC ${APPLICATIONS_SRC} ${ATTRIBUTES_SRC} ... ${UTILS_SRC} ) ADD_LIBRARY (my_lib ${FULL_SRC}) Thanks in advance P.S. : excuse the poor English, as i'ts not my mother tongue :) -- - Always keep in mind that you may be wrong - ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Olivier DOLE Pleyo Software Engineer ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Pass variables to sub directory CMakeLists.txt
Hello, On 2/21/08, Vandenbroucke Sander [EMAIL PROTECTED] wrote: Hi, I want to pass a variable to CMakeLists.txt's in sub directories: Top directory CMakeLists.txt: set( VAR1 ) add_subdirectory (subdir1) add_subdirectory (subdir2) Each subdir CMakeLists.txt: ... set( VAR1 ${VAR1} extend_var1 ) ... I use VAR1 later on in the linker. How can I make this work? See this thread form yesterday for your answer ;) http://www.cmake.org/pipermail/cmake/2008-February/019986.html Regards, Kind regards, Sander. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Olivier DOLE Pleyo Software Engineer ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Appending paths to a variable
Hello, On 2/20/08, Robert Bielik [EMAIL PROTECTED] wrote: I have a structure where I include all subdirs via FILE(GLOB.. and FOREACH and within each subdir CMakeLists.txt I want to add a path to be used with INCLUDE_DIRECTORIES in the main CMakeLists.txt I tried SET(INCL_DIRS ${INCL_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include) but the INCL_DIRS variable is empty when I get back to the main CMakeLists.txt file... How to? To retrieve a variable from a subdirectory (added via ADD_SUBDIRECTORY), you have to do something like: GET_DIRECTORY_PROPERTY (MYVAR DIRECTORY subdirectory DEFINITION INCL_DIRS) Have a look at cmake documentation for more info about GET_DIRECTORY_PROPERTY. Regards, TIA /R ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Olivier DOLE Software Engineer ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] statically linked executables
2007/11/27, Daniel Rueckert [EMAIL PROTECTED]: Hi, I am trying to build some statically linked executables on a linux box. I have added the -static option to the linker flags and specified static link libraries but for some reason cmake still adds the option -Wl,-Bdynamic flag to the linker options. Is there any way around this? Thanks, Daniel Hello, I exactly face the same problem with cmake-2.4.6: http://www.sand-labs.org/owb/ticket/160 But I assure that it perfectly worked with cmake-2.4.3. So is there a regression between cmake-2.4.3 and cmake-2.4.6 or a new way to manage static link that I have missed (and so my CMakeFiles are not valid anymore)? Regards -- Daniel Rueckert, Ph.D. Department of Computing Imperial College London 180 Queens' Gate Tel: +44 20 7594 8333 London SW7 2AZ Fax: +44 20 7581 8024 mailto:[EMAIL PROTECTED] http://www.doc.ic.ac.uk/~dr ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Olivier DOLE ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] statically linked executables
2007/12/3, Bill Hoffman [EMAIL PROTECTED]: Oliver Dole wrote: 2007/11/27, Daniel Rueckert [EMAIL PROTECTED]: Hi, I am trying to build some statically linked executables on a linux box. I have added the -static option to the linker flags and specified static link libraries but for some reason cmake still adds the option -Wl,-Bdynamic flag to the linker options. Is there any way around this? Thanks, Daniel Hello, I exactly face the same problem with cmake-2.4.6: http://www.sand-labs.org/owb/ticket/160 But I assure that it perfectly worked with cmake-2.4.3. So is there a regression between cmake-2.4.3 and cmake-2.4.6 or a new way to manage static link that I have missed (and so my CMakeFiles are not valid anymore)? A change was made to make sure that CMake picks the libraries you specified. So, if you have /usr/lib/libfoo.so, CMake will add -Wl,-dynamic -lfoo around foo. But if you have /usr/lib/libfoo.a, then cmake will add -Wl,-static -lfoo around foo. So, if CMake is given a full path to a shared library it will add -Wl,-dyanmic around it. -Bill Bill, thanks for the info and for the quick reply. The problem is that I use pkg-config (and stuff like that) to retrieve my libraries. So CMake does not know wether it is static or shared libraries to use. Nonetheless I have found a workaround thanks to this thread: http://www.cmake.org/pipermail/cmake/2006-September/011096.html So I have just added the following in my CMakeFiles: IF (NOT BUILD_SHARED_LIBS) SET (LIBRARIES_TO_LINK ${LIBRARIES_TO_LINK} -Wl,-Bstatic ${LIBXSLT_LIBS}) ELSE (NOT BUILD_SHARED_LIBS) SET (LIBRARIES_TO_LINK ${LIBRARIES_TO_LINK} ${LIBXSLT_LIBS}) ENDIF (NOT BUILD_SHARED_LIBS) Unfortunately I still have a problem, but which is not due to cmake. My application indirectly needs to link with -lgcc_s and I do not have the static library for that, so I get an error :'( -- Olivier DOLE ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] statically linked executables
2007/12/3, Hendrik Sattler [EMAIL PROTECTED]: Quoting Oliver Dole [EMAIL PROTECTED]: The problem is that I use pkg-config (and stuff like that) to retrieve my libraries. So CMake does not know wether it is static or shared libraries to use. Nonetheless I have found a workaround thanks to this thread: http://www.cmake.org/pipermail/cmake/2006-September/011096.html So I have just added the following in my CMakeFiles: IF (NOT BUILD_SHARED_LIBS) SET (LIBRARIES_TO_LINK ${LIBRARIES_TO_LINK} -Wl,-Bstatic ${LIBXSLT_LIBS}) ELSE (NOT BUILD_SHARED_LIBS) SET (LIBRARIES_TO_LINK ${LIBRARIES_TO_LINK} ${LIBXSLT_LIBS}) ENDIF (NOT BUILD_SHARED_LIBS) Unfortunately I still have a problem, but which is not due to cmake. My application indirectly needs to link with -lgcc_s and I do not have the static library for that, so I get an error :'( Why do you try to work around that? Instead, do it properly by using find_library: pkg_check_modules ( PKGCONFIG_MYPREFIX something ) foreach ( i ${PKGCONFIG_MYPREFIX_STATIC_LIBRARIES} ) find_library ( ${i}_LIBRARY NAMES ${i} PATHS ${PKGCONFIG_MYPREFIX_LIBRARY_DIRS} ) list ( APPEND MYPREFIX_LIBRARIES ${i}_LIBRARY ); endforeach ( i) Actually, FindPkgConfig.cmake should be changed to give full paths to libraries. Also note, that you MUST use the pkgconfig variables for static linking, not the ones for dynamic linking (see module help of FindPkgConfig) Ok thanks, I will have a look at this. I am sure that somehow this can be made to find only the static libs, if not then that should be fixed. OTOH, you may want to reconsider if you really want to give your users so much pain :-/ RAM is cheap but not available for free. Additionally, building a static library does NOT mean that you have to link everything statically. You'll regret such a decision sooner or later. Yes I know that static linking has more drawbacks than advantages. A typical example is that if someone fix a bug in a library my application is linked with, I will have to rebuild my whole application to have this fix propagate. Of course from my point of view static link is only a feature. But if that can be a real working feature, that's better. HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Olivier DOLE ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Module to detect SDL_GFX
Hello, You will find as an attachment a dummy cmake module which automates SDL_GFX detection as it is already done for SDL_ttf, SDL_image... This module is in fact a copy and paste with of course modifications of SDL_image module done by Eric Wing. Note that I have only tested it on Linux... So if anybody can confirm that it works for other OS. Regards, -- Olivier DOLE Software Engineer # - Locate SDL_gfx library # This module defines # SDLGFX_LIBRARY, the library to link against # SDLGFX_FOUND, if false, do not try to link to SDL # SDLGFX_INCLUDE_DIR, where to find SDL/SDL_gfxPrimitives.h # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. # # Created by Olivier DOLE. This was copied from the FindSDL_image.cmake # module. # On OSX, this will prefer the Framework version (if found) over others. # People will have to manually change the cache values of # SDLGFX_LIBRARY to override this selection. FIND_PATH(SDLGFX_INCLUDE_DIR SDL_gfxPrimitives.h $ENV{SDLGFXDIR}/include $ENV{SDLDIR}/include ~/Library/Frameworks/SDL_gfx.framework/Headers /Library/Frameworks/SDL_gfx.framework/Headers /usr/local/include/SDL /usr/include/SDL /usr/local/include/SDL12 /usr/local/include/SDL11 # FreeBSD ports /usr/include/SDL12 /usr/include/SDL11 /usr/local/include /usr/include /sw/include/SDL # Fink /sw/include /opt/local/include/SDL # DarwinPorts /opt/local/include /opt/csw/include/SDL # Blastwave /opt/csw/include /opt/include/SDL /opt/include ) # I'm not sure if I should do a special casing for Apple. It is # unlikely that other Unix systems will find the framework path. # But if they do ([Next|Open|GNU]Step?), # do they want the -framework option also? IF(${SDLGFX_INCLUDE_DIR} MATCHES .framework) # Extract the path the framework resides in so we can use it for the -F flag STRING(REGEX REPLACE (.*)/.*\\.framework/.* \\1 SDLGFX_FRAMEWORK_PATH_TEMP ${SDLGFX_INCLUDE_DIR}) IF(${SDLGFX_FRAMEWORK_PATH_TEMP} STREQUAL /Library/Frameworks OR ${SDLGFX_FRAMEWORK_PATH_TEMP} STREQUAL /System/Library/Frameworks ) # String is in default search path, don't need to use -F SET(SDLGFX_LIBRARY -framework SDL_gfx CACHE STRING SDL_gfx framework for OSX) ELSE(${SDLGFX_FRAMEWORK_PATH_TEMP} STREQUAL /Library/Frameworks OR ${SDLGFX_FRAMEWORK_PATH_TEMP} STREQUAL /System/Library/Frameworks ) # String is not /Library/Frameworks, need to use -F SET(SDLGFX_LIBRARY -F${SDLGFX_FRAMEWORK_PATH_TEMP} -framework SDL_gfx CACHE STRING SDL_gfx framework for OSX) ENDIF(${SDLGFX_FRAMEWORK_PATH_TEMP} STREQUAL /Library/Frameworks OR ${SDLGFX_FRAMEWORK_PATH_TEMP} STREQUAL /System/Library/Frameworks ) # Clear the temp variable so nobody can see it SET(SDLGFX_FRAMEWORK_PATH_TEMP CACHE INTERNAL ) ELSE(${SDLGFX_INCLUDE_DIR} MATCHES .framework) FIND_LIBRARY(SDLGFX_LIBRARY NAMES SDL_gfx PATHS $ENV{SDLGFXDIR}/lib $ENV{SDLDIR}/lib /usr/local/lib /usr/lib /sw/lib /opt/local/lib /opt/csw/lib /opt/lib ) ENDIF(${SDLGFX_INCLUDE_DIR} MATCHES .framework) SET(SDLGFX_FOUND NO) IF(SDLGFX_LIBRARY) SET(SDLGFX_FOUND YES) ENDIF(SDLGFX_LIBRARY) ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Is CMake powerful enough?
Hello, Thanks for the many answers! First some remarks to specific remarks I got and then what seems best to do. - Alan W. Irwin wrote: I always run cmake with a separate build tree so one set of terminal windows is open in various sub-directories of the source tree and one set in various sub-directories of the build tree, and I now think of this as the natural way to develop. I can hardly imagine this to be practical in my case: 1. There are really quite a few directories, all nested (recursively), and always mirroring the directory movements would be a pain (and error prone). 2. And then there is the concept of an active library, which roughly says that the users of the library have *all the power* the developer have --- and since the users very likely want it convenient, also the developer needs to have it very convenient ;-) (((Testing, version control etc., packaging is not something reserved to the developers side, and the user then get only the distribution, but the user get a full clone (with version control history etc.) of my clone, and then they can create distributions etc. exactly as I can do --- this is not so trivially achieved (at least this is my experience), but we are getting closer to it (for example creating a release becomes trivial --- just clone your own clone!). (Sorry for making here propaganda for a concept which I cannot really demonstrate (yet); but actually the build system is a very important part of it, and thus I feel these kind of discussions are not completely wrong here. But it seems that having a master script which runs CMake and make appropriately should do the job (see below). Also, you mentioned testing. For that, check out the ADD_TEST command. I know ctest (or the equivalent make test) works in the top directory of the build-tree, and I assume it also works in subdirectories of that tree although I haven't actually tried that. The whole directory structure issue still worries me, but we'll see. Thanks Alan! - Alexander Neundorf wrote: You can detect directories and/or files with cmake, using IF(EXISTS) or FILE(GLOB). This way you can collect at cmake time the directories or files you want to build. If you then add a new file/directory, you will have to touch any of the cmake files to force cmake to run again if you enter make (or run cmake directly). But I would not recommend this (because people will forget to rerun cmake or to touch a file). I got the impression, that having that master script (which for example is responsible for creating new files or new directories) together with the cmake possibilities should do the job (in a convenient and safe way). It seems the basic assumption is that of having a build-directory (used only once), where all sort of stuff can be dumped to, and then with the final make install the relevant files are moved elsewhere? Yes. But why would you care about helper files in your build tree ? Yet I know about every little file what it's good for and where it belongs (like a good father, I care for my little files). The triad source - build - install is like a purgatory, where the soul (the source) must go through hell (the build) until it emerges in purified form (the install), however here I feel more like a modern manager, who doesn't like to have idle files sitting around where he doesn't know what they are doing. Irony aside, it's hard to say what are the consequences of all such design decisions. But you can set up the directories where libraries and executables go explicitely by setting the EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH. That I will try: Having as much control as possible, and the rest is hidden away in the dungeon. While it takes a bit to get used to, building out-of-source has many advantages and once your used to it you don't want to build in-source anymore. That's perfectly clear. For example: -you can simply remove the buildtree and rerun cmake so everything's fresh again Here my current system (not having a build tree and an install tree, but a more complex system for all the different types of files) pays off: I can easily remove for example the dependency-files for one submodule or for a sub-sub-module, or for the whole library, or I can inspect them --- and actually from time to time it's needed. But perhaps in the future cmake might offer a bit more control (I'm not the only control freak out there). Thanks Alex! Brandon Van Every wrote: Oliver sounds like he wants crazy dynamic everything with all sorts of elegant CS interfaces and research possibilities etc. That's correct, I try my best to become a crazy scientist (however this is not so easy(!) --- I'm not there yet). Some people think that a fully featured, elegant, abstract, powerful programming is necessary for a build system
[CMake] Is CMake powerful enough?
, but more of a convenient user-interface, with the typical trade-off: What the user-interface does, it does convenient and well, but what it not does is very hard to integrate? -- We would be thankful for any comments! Oliver -- Dr. Oliver Kullmann Computer Science Department University of Wales Swansea Faraday Building, Singleton Park Swansea SA2 8PP, UK http://cs-svr1.swan.ac.uk/~csoliver/ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] what to download for Linux??
Hello, I want to build cmake from the sources, on a Linux platform. Now it seems I have the choice between cmake-2.4.6-Linux-i386.tar.gz and cmake-2.4.6.tar.gz ?? Intuitively, I would go for the second choice (called Unix Linefeed Source, where I have no clue what the Linefeed stands for), since Unix normally includes Linux, and a generic name like cmake-2.4.6.tar.gz is similar to for example the gcc- or doxygen-packages-names. However what then is that Linux-package good for?? I know that i386 stands for some architecture, but I don't know whether my platforms are such or not, and I also expect the build process to find out on its own, without me having to specify this implementation detail?? (When building gcc, or, say, make, it does not bother the user with such details.) I have purchased the book, but neither there nor on the web page anything is said about which package to use when (just follow the instructions, but there are none). I couldn't make good use of the search functions for the e-mail lists neither (always end up with some google search). Any hint would be appreciated. Thanks Oliver ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake