Re: [cmake-developers] ninja enforces explicit dependencies before order-only
On Tue, Apr 2, 2013 at 9:19 AM, Brad King brad.k...@kitware.com wrote: ... a side effect? Is there another way to do this in CMake's Ninja gen? Yes I have found a way we can do this in CMake's Ninja generator. The Ninja generator needs to be taught to create phony ninja targets for any file that exists in the build directory and which is a dependency of a custom command target ( this might need to be expanded to a dependency of any target in the future). Ninja phony targets can also be used to create targets for files which may not exist at build time otherwise an error will occur if the file does not exist. I hope to have a branch by the end of this week that will update the Ninja generator with this fix. -- Robert Maynard -- 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] usr-move v. cross-compiling
On 04/01/2013 10:25 AM, Brad King wrote: http://www.cmake.org/Bug/view.php?id=14041 Our usr-move changes to hard-code the /usr prefix conflicts with cross-compiling cases where the host side relocates a package under some new root and finds it with CMAKE_FIND_ROOT_PATH. Here is a fix using a new approach to support usr-move: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c613b43 While implementing this I realized the old approach was not fully implemented in configure_package_config_file anyway because while not referencing PACKAGE_PREFIX_DIR it would still leave that variable set improperly after PACKAGE_INIT. The new approach restores the original references to PACKAGE_PREFIX_DIR in all cases but adds code to fix its value in the usr-move case. -Brad -- 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
[cmake-developers] CMake master, Qt dialog and Qt4/5 installed has problems
Hi, I was updating my machine earlier today, and wanted to build the latest CMake master (00ef90). I am using Arch Linux with Qt 4 and Qt 5 installed. If I compile with qmake-qt4 then I see the following compile failure, [ 88%] Generating qrc_CMakeSetup.cpp /bin/sh: //bin/rcc: No such file or directory make[2]: *** [Source/QtDialog/qrc_CMakeSetup.cpp] Error 127 make[1]: *** [Source/QtDialog/CMakeFiles/cmake-gui.dir/all] Error 2 make: *** [all] Error 2 Making the following changed allowed me to compile the Qt dialog with Qt 4, diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 1684fb2..2966082 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -12,7 +12,7 @@ project(QtDialog) find_package(Qt5Widgets QUIET) -if (Qt5Widgets_FOUND) +if (Qt5Widgets_FOUND AND FALSE) include_directories(${Qt5Widgets_INCLUDE_DIRS}) add_definitions(${Qt5Widgets_DEFINITONS}) macro(qt4_wrap_ui) It seems like even when not using Qt 5 it is attempting to use it, but failing here at least. I didn't look into it too deeply - is the new behavior to force Qt 5 if available? I haven't been following master in the last couple of weeks, but it would be nice to resolve the issue before the next release. Marcus -- 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Documentation 'latest' url
On 09/21/2012 04:36 PM, Stephen Kelly wrote: Hi, This page has links for various versions of cmake: http://www.cmake.org/cmake/help/documentation.html Would it be possible to get a 'latest' url too, such as http://www.cmake.org/cmake/help/latest/cmake.html It would make more sense to link to such a url from the Qt documentation. Thanks, Steve. Excavating this oldish, unanswered post: +1 from me! It certainly would help linking to the up-to-date docs from the Wiki... 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [CMake] CMake extracting tar via execute_process does not allow extraction in subdirectories
2013/4/3 Saad Khattak saadrus...@gmail.com That prints the directory in the console: Z:/engine/src/mySDK But did not extract to it. Note that mySDK exists, and the tar is in the 'src' folder and I am able to extract in the 'src' folder properly. Ok this is weird. Which version of CMake are you using? (try cmake --version) You seem to be running on a Windows host, do you use native CMake or some combination of cygwin and cygwin cmake? Which cmake generator are you using? (Visual Studio xxx, MinGW, ...) Is cmake able to untar manually i.e. could you try that: cd Z:/engine/src/mySDK cmake -E tar xvf ../mySDK.tar.gz -- 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 do I search for personal libraries?
You should find this interesting: http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file In short: * In project A create a AConfig.cmake file and export your targets * In project B call find_package(A REQUIRED) HTH Michael On Wed, Apr 3, 2013 at 7:44 AM, Saad Khattak saadrus...@gmail.com wrote: Hi, Suppose I have two personal repositories: A and B. Repository B has a dependency on repository A i.e. repository A builds multiple libraries and repository B builds multiple libraries and executables. I can build 32-bit and 64-bit libraries/executables for both by having a 'build' and 'buildx64' projects generated by CMake. The libraries and executables are put in the default folders (e.g. repoA/build/src/libraryName/Debug and repoA/buildx64/src/library/Debug). Repo B's executables depend on repo A's libraries and libraries in B. Linking with libraries within B is straightforward as CMake is able to figure out the necessary paths for the libraries B is building which B's executables depend on. Repo B also depends on Repo A's libraries and all executables in B have to search for them. How do I go about this? Currently I am searching for each library by specifying its path: # I have a CACHE variable for the path to Repo A's build folder that the user must provide target_link_libraries(myProject repoAPath/build/src/LibName/${CMAKE_CFG_INTDIR}) which feels like a very wrong way to go about linking with other libraries considering CMake is supposed to make the finding libraries part easier. I would appreciate clarification of the workflow in this case. Thanks, Saad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] The else() in CMAKE_TOOLCHAIN_FILE
Hi, On Tuesday, 2. April 2013, 06:42:47, Ashi wrote: I think I find something to explain this: the config.cmake(the CMAKE_TOOLCHAIN_FILE) is reloaded several times. on first-load, the A is set, but on second-load and later-load, the A is not set. I think I can get around this problem when A is kept set. However, I don't know how can I keep the value set in cmake. Could anyone give me some suggestion? Thanks! I'm not entirely sure what you're trying to do, but it seems like you would want to make A, B, and C into cache variables. That way subsequent cmake runs will use the same value... Johannes -- 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] The else() in CMAKE_TOOLCHAIN_FILE
On 03. april 2013 13:13, Johannes Zarl wrote: Hi, On Tuesday, 2. April 2013, 06:42:47, Ashi wrote: I think I find something to explain this: the config.cmake(the CMAKE_TOOLCHAIN_FILE) is reloaded several times. on first-load, the A is set, but on second-load and later-load, the A is not set. I think I can get around this problem when A is kept set. However, I don't know how can I keep the value set in cmake. Could anyone give me some suggestion? Thanks! I'm not entirely sure what you're trying to do, but it seems like you would want to make A, B, and C into cache variables. That way subsequent cmake runs will use the same value... Johannes Hi, I'm thinking that one solution could be to create three (or four?) toolchain files, one for each if clause? Cheers, Yngve -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Compiling object files.
Hello, Summary: How do I use CMake to compile object files? Or is this the wrong question to ask? (i.e. *should* I be compiling object files?) Details: - I am starting to learn CMake, so I am not even sure I am formulating my questions the right way... I have a large Makefile that I want to try to convert to CMake. I did not write the Makefile and I know little about build systems. But I am interested in CMake and I want to experiment anyway. My first question is how to convert something like this: cparam.o: cparam.f90 cparam.local cparam.inc cparam_pencils.inc if [ ]; then \ rm -f cparam.inc; \ rm -f cparam_pencils.inc; \ ln -s cparam.inc cparam.inc; \ ln -s cparam_pencils.inc cparam_pencils.inc; \ fi $(FC) $(FFLAGS) $(FFLAGS_GENERAL) $(F90FLAGS) -o cparam.o -c cparam.f90 I cannot imagine what the if statement could possibly accomplish, but I trust that CMake would make the whole thing unnecessary. So I figure (hope) that all I have to do is tell CMake to make the object file cparam.o. The problem is that I cannot find anything in the instructions for making object files. All I see is commands like: add_executable(hello hello.f90 world.f90) add_library(particles backend.f90 vector.f90 const.f90) There is no add_object function or anything like it... Maybe I am going about it the wrong way. Maybe I should not be thinking in terms of making object files at all. Perhaps I should be planning to do something like: add_executable(myprogram ${HUGE_LIST_OF_200_FILES}) My worry with this approach is that I see no room to convert the Makefile incrementally. I was thinking of compiling just one object file, check that that works and has the right symbols, and then move to the next object file. Whereas this other option looks like an all or nothing proposition. I would welcome any words of advice here. Cheers, Daniel. -- Lord of the rings calendar in your Linux/Unix/Mac terminal: cat /usr/share/calendar/calendar.lotr -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Compiling object files.
Hello Daniel, I'm also starting with CMake and I had a problem to link an object to my project. I will describe you what I did because it works for me but keep in mind that maybe there is a better way. First, you can compile object files with the command execute_process: execute_process( COMMAND $(FC) $(FFLAGS) $(FFLAGS_GENERAL) $(F90FLAGS) -o cparam.lib -c cparam.f90 ) Note that it is not cparam.o but cparam.lib. Then you can link it to your project as a library with the command target_link_libraries: target_link_libraries( your_project cparam.lib ) Hope it can help you. Damien -- View this message in context: http://cmake.3232098.n2.nabble.com/Compiling-object-files-tp7583910p7583911.html Sent from the CMake mailing list archive at Nabble.com. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] MinGW Link with -l instead of path?
All of these articles say the way to avoid having an absolute path stored in the linked output is to use -L dir -l lib ... which is definatly not what cmake is producing. Reflecting on this, maybe I can replace target_link_libraries with manually specified link_flags; maybe some sort of similarly named macro http://stackoverflow.com/questions/14551204/any-way-to-make-ld-record-shared-library-name-only-no-subdirs http://stackoverflow.com/questions/1124809/embedding-absolute-path-for-shared-libraries http://stackoverflow.com/questions/2726993/g-how-to-specify-preference-of-library-path On Tue, Apr 2, 2013 at 9:29 AM, J Decker d3c...@gmail.com wrote: So from the silence, either I described my issue badly, or there isn't a way? From the script at the end, when generating 'unix makefiles' with a mingw environment, or MingW makefiles, these are the gcc commands (compile .obj) c:/tools/unix/mingw.mangled/bin/gcc.exe -Dtest2_EXPORTS -o CMakeFiles/test2.dir/test2.c.obj -c M:/tmp/cmake_crash/test4/test2.c (link .dll) c:/tools/unix/mingw.mangled/bin/gcc.exe -shared -o libtest2.dll -Wl,--out-implib,libtest2.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,@CMakeFiles/test2.dir/objects1.rsp -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 (compile .obj) c:/tools/unix/mingw.mangled/bin/gcc.exe-o CMakeFiles/test1.dir/test1.c.obj -c M:/tmp/cmake_crash/test4/test1.c (link .exe) c:/tools/unix/mingw.mangled/bin/gcc.exe -Wl,@CMakeFiles/test1.dir/objects1.rsp -o test1.exe -Wl,--out-implib,libtest1.dll.a -Wl,--major-image-version,0,--minor-image-version,0 libtest2.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 In the link .exe step, it references the full name (and full path) of the libtest2.dll.a ... if this were a more complex case where a library is built in the root, the path could be like ../../../../liblib.dll.a. Now, as a windows target this doesn't matter so much, but when using a toolchain file to target android, the full path to the .so gets embedded. c:\general\android-ndk-r8c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-gcc.exe --sysroot=c:/general/android-ndk-r8c/platforms/android-14/arch-arm -Dtest2_EXPORTS -fPIC -Ic:\general\android-ndk-r8c\platforms\android-14\arch-arm\usr\include -Ic:\general\android-ndk-r8c\sources\cxx-stl\gnu-libstdc++\4.6\include -Ic:\general\android-ndk-r8c\sources\cxx-stl\gnu-libstdc++\4.6\libs\armeabi\include -o CMakeFiles\test2.dir\test2.c.obj -c M:\tmp\cmake_crash\test4\test2.c c:\general\android-ndk-r8c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-gcc.exe --sysroot=c:/general/android-ndk-r8c/platforms/android-14/arch-arm -fPIC -shared -o libtest2.so CMakeFiles/test2.dir/test2.c.obj -Lc:\general\android-ndk-r8c\platforms\android-14\arch-arm\usr\lib -Lc:\general\android-ndk-r8c\sources\cxx-stl\gnu-libstdc++\4.6\libs\armeabi c:\general\android-ndk-r8c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-gcc.exe --sysroot=c:/general/android-ndk-r8c/platforms/android-14/arch-arm -Ic:\general\android-ndk-r8c\platforms\android-14\arch-arm\usr\include -Ic:\general\android-ndk-r8c\sources\cxx-stl\gnu-libstdc++\4.6\include -Ic:\general\android-ndk-r8c\sources\cxx-stl\gnu-libstdc++\4.6\libs\armeabi\include -o CMakeFiles\test1.dir\test1.c.obj -c M:\tmp\cmake_crash\test4\test1.c c:\general\android-ndk-r8c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-gcc.exe --sysroot=c:/general/android-ndk-r8c/platforms/android-14/arch-arm CMakeFiles/test1.dir/test1.c.obj -o test1 -Lc:\general\android-ndk-r8c\platforms\android-14\arch-arm\usr\lib -Lc:\general\android-ndk-r8c\sources\cxx-stl\gnu-libstdc++\4.6\libs\armeabi libtest2.so see... libtest2.so . So, since I REALLY need a solution for this; I guess, what I can do is stretch out the projects into multiple cmake passes, and treat it more like an installed library. On Tue, Mar 19, 2013 at 3:05 AM, J Decker d3c...@gmail.com wrote: I'm using MinGW Makefiles as a base and a toolchain file. I made a (somewhat) simple cmakelists that makes a library, and an executable that links against it. Without specifying the toolchain, the link command looks something like gcc test1.c.obj -o test1 -ltest2 (hmm no, that's what I want it to say) what it does say is more like gcc test1.c.obj -o test1 test2.dll.a or gcc test1.c.obj -o test1 libtest2.so can I convince Cmake to generate references to libraries with -l instead of the path to the library it linked? ; or, the warnings (potential errors?) I'm getting say like... /bin/ld.exe: warning: libbag.so, needed by ..\..\..\..\libbag.psi++.so, not found (try using -rpath or -rpath-link) .../bin/ld.exe: warning: libbag++.so,
Re: [CMake] Compiling object files.
Hi Daniel, On Wednesday, 3. April 2013, 16:06:36, Daniel Carrera wrote: Summary: How do I use CMake to compile object files? Or is this the wrong question to ask? (i.e. *should* I be compiling object files?) Short answer: normally you don't and you shouldn't add statements to compile object files. CMake is a build system generator, not a build-system in itself. I.e. you only tell cmake I want to build library A from source files a.cpp and b.cpp, and I want to link my application C , which is created from c.cpp, to the library A. CMake then generates the build system (e.g. Makefiles or a Visual Studio solution) for you. Details: - I am starting to learn CMake, so I am not even sure I am formulating my questions the right way... I have a large Makefile that I want to try to convert to CMake. I did not write the Makefile and I know little about build systems. But I am interested in CMake and I want to experiment anyway. If you have problems with the terminology and concepts behind cmake, I would recommend browsing through the wiki ( http://www.cmake.org/Wiki/CMake#Basic_Introductions ). While it can be overwhelming at first, there is a wealth of information to be found there. My first question is how to convert something like this: cparam.o: cparam.f90 cparam.local cparam.inc cparam_pencils.inc if [ ]; then \ rm -f cparam.inc; \ rm -f cparam_pencils.inc; \ ln -s cparam.inc cparam.inc; \ ln -s cparam_pencils.inc cparam_pencils.inc; \ fi $(FC) $(FFLAGS) $(FFLAGS_GENERAL) $(F90FLAGS) -o cparam.o -c cparam.f90 I cannot imagine what the if statement could possibly accomplish, but I trust that CMake would make the whole thing unnecessary. The if statement is effectively just a block-comment. You can just ignore it and its contents. So I figure (hope) that all I have to do is tell CMake to make the object file cparam.o. The problem is that I cannot find anything in the instructions for making object files. All I see is commands like: add_executable(hello hello.f90 world.f90) add_library(particles backend.f90 vector.f90 const.f90) There is no add_object function or anything like it... Maybe I am going about it the wrong way. Maybe I should not be thinking in terms of making object files at all. Perhaps I should be planning to do something like: add_executable(myprogram ${HUGE_LIST_OF_200_FILES}) That's the right way to go. Although if you have over 200 input files, you might want to group them into libraries if that's appropriate. My worry with this approach is that I see no room to convert the Makefile incrementally. I was thinking of compiling just one object file, check that that works and has the right symbols, and then move to the next object file. Whereas this other option looks like an all or nothing proposition. Converting incrementally can't be done IMO (at least not without significant overhead). Since you would probably use the Makefile generator of cmake, you would probably just end up with cmake overwriting your makefiles or similar problems. I hope that cleared up some of the confusion. Please do ask again if there are problems... Johannes -- 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] Problems Building Google Test with CMake 2.6
Hello, I am trying to use CMake 2.6 to build Google Test. As mentioned in the README of Google Test, I have issued following commands: mkdir mybuild # Create a directory to hold the build output. cd mybuild cmake D:\gtest-1.6.0 # But I get following errors: CMake Error: CMake was unable to find a build program corresponding to Visual Studio 6. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: Could not find cmake module file:/D://CMakeFiles/CmakeCXXCompiler.cmake CMake Error: Could not find cmake module file:/D://CMakeFiles/CmakeCCompiler.cmake Can anyone please help? What is wrong and how to resolve this problem? Thanks. D. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Problems Building Google Test with CMake 2.6
On Wednesday 03 April 2013 19:54:25 Dan page wrote: Hello, I am trying to use CMake 2.6 to build Google Test. As mentioned in the README of Google Test, I have issued following commands: mkdir mybuild # Create a directory to hold the build output. cd mybuild cmake D:\gtest-1.6.0 # But I get following errors: CMake Error: CMake was unable to find a build program corresponding to Visual Studio 6. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: Could not find cmake module file:/D://CMakeFiles/CmakeCXXCompiler.cmake CMake Error: Could not find cmake module file:/D://CMakeFiles/CmakeCCompiler.cmake Can anyone please help? What is wrong and how to resolve this problem? Thanks. D. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake The approach I usually use is to compile my unit tests together with google framework sources. In my cmake file I have the following line: add_executable ( target ${SRCS} ${GTEST_DIR}/src/gtest-all.cc ${GTEST_DIR}/src/gtest_main.cc ) GTEST_DIR is specified as command line parameter with the location of gtest sources. -- Bogdan -- 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] MinGW Link with -l instead of path?
alternate target_link_libraries. Usage is the same. Test if each library to link is a target, get that targets path, and break it into parts and add it to LINK_FLAGS else add with target_link_libraries... macro(my_target_link_libraries target ) if(CMAKE_COMPILER_IS_GNUCC) foreach( target_lib ${ARGN} ) if( TARGET ${target_lib} ) get_property( lib_path TARGET ${target_lib} PROPERTY LOCATION) if( ${lib_path} MATCHES (.*)/([^/]*)$ ) get_target_property(existing_link_flags ${target} LINK_FLAGS) if(existing_link_flags) set(new_link_flags ${existing_link_flags} -L ${CMAKE_MATCH_1} -l ${target_lib}) else() set(new_link_flags -L ${CMAKE_MATCH_1} -l ${target_lib}) endif() set_target_properties( ${target} PROPERTIES LINK_FLAGS ${new_link_flags}) endif( ${lib_path} MATCHES (.*)/([^/]*)$ ) else() target_link_libraries( ${target} ${target_lib} ) endif( TARGET ${target_lib} ) endforeach( target_lib ${ARGN} ) else() target_link_libraries( ${target} ${ARGN} ) endif() endmacro() -- 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] [vtkusers] compiling examples using Xcode
I already have CMake 2.8.1 installed. Sorry for not specifying that earlier. I also have installed the GIT repository version of VTK. If CMake is not found then it is either not properly installed or not in your path. John -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] CMake extracting tar via execute_process does not allow extraction in subdirectories
I am using version 2.8.8. I am running Windows 7 and do not use cygwin, only native CMake. cd Z:/engine/src/mySDK cmake -E tar xvf ../mySDK.tar.gz That works. The tar is successfully extracted to the mySDK folder. As before, it appears it can only extract to the current directory. - Saad On Wed, Apr 3, 2013 at 2:08 AM, Eric Noulard eric.noul...@gmail.com wrote: 2013/4/3 Saad Khattak saadrus...@gmail.com That prints the directory in the console: Z:/engine/src/mySDK But did not extract to it. Note that mySDK exists, and the tar is in the 'src' folder and I am able to extract in the 'src' folder properly. Ok this is weird. Which version of CMake are you using? (try cmake --version) You seem to be running on a Windows host, do you use native CMake or some combination of cygwin and cygwin cmake? Which cmake generator are you using? (Visual Studio xxx, MinGW, ...) Is cmake able to untar manually i.e. could you try that: cd Z:/engine/src/mySDK cmake -E tar xvf ../mySDK.tar.gz -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Compiling object files.
Hi Johannes, On 3 April 2013 17:44, Johannes Zarl johannes.z...@jku.at wrote: Short answer: normally you don't and you shouldn't add statements to compile object files. CMake is a build system generator, not a build-system in itself. I.e. you only tell cmake I want to build library A from source files a.cpp and b.cpp, and I want to link my application C , which is created from c.cpp, to the library A. CMake then generates the build system (e.g. Makefiles or a Visual Studio solution) for you. Thanks. I guess that makes sense. If you have problems with the terminology and concepts behind cmake, I would recommend browsing through the wiki ( http://www.cmake.org/Wiki/CMake#Basic_Introductions ). While it can be overwhelming at first, there is a wealth of information to be found there. Thanks. I have been impressed by the quantity of CMake documentation. There is not as much for Fortran, but I think that by now I've learnt most of the Fortran-specific stuff. I will keep reading through the docs. As you said, it is a bit overwhelming at first. There is no add_object function or anything like it... Maybe I am going about it the wrong way. Maybe I should not be thinking in terms of making object files at all. Perhaps I should be planning to do something like: add_executable(myprogram ${HUGE_LIST_OF_200_FILES}) That's the right way to go. Although if you have over 200 input files, you might want to group them into libraries if that's appropriate. Thanks. At least now I have the right idea. I think I will try to come up with logical groupings that can be turned into libraries. Converting incrementally can't be done IMO (at least not without significant overhead). Since you would probably use the Makefile generator of cmake, you would probably just end up with cmake overwriting your makefiles or similar problems. I don't mean that I expect to compile the entire program with a half-Makefile, half-CMake system. I like your idea of making libraries. If I can make a library with a handful of files and I can verify that the compile didn't fail and the library has the correct symbols, I would call that a successful incremental step. I hope that cleared up some of the confusion. Please do ask again if there are problems... Very helpful. Thanks. Cheers, Daniel. -- 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 do I search for personal libraries?
Thanks Michael. The link is very helpful (although very hard to digest [probably because I am new to CMake] - I have gone over it multiple times now and don't fully understand everything). I will experiment with those commands in my projects. - Saad On Wed, Apr 3, 2013 at 2:52 AM, Michael Wild them...@gmail.com wrote: You should find this interesting: http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file In short: * In project A create a AConfig.cmake file and export your targets * In project B call find_package(A REQUIRED) HTH Michael On Wed, Apr 3, 2013 at 7:44 AM, Saad Khattak saadrus...@gmail.comwrote: Hi, Suppose I have two personal repositories: A and B. Repository B has a dependency on repository A i.e. repository A builds multiple libraries and repository B builds multiple libraries and executables. I can build 32-bit and 64-bit libraries/executables for both by having a 'build' and 'buildx64' projects generated by CMake. The libraries and executables are put in the default folders (e.g. repoA/build/src/libraryName/Debug and repoA/buildx64/src/library/Debug). Repo B's executables depend on repo A's libraries and libraries in B. Linking with libraries within B is straightforward as CMake is able to figure out the necessary paths for the libraries B is building which B's executables depend on. Repo B also depends on Repo A's libraries and all executables in B have to search for them. How do I go about this? Currently I am searching for each library by specifying its path: # I have a CACHE variable for the path to Repo A's build folder that the user must provide target_link_libraries(myProject repoAPath/build/src/LibName/${CMAKE_CFG_INTDIR}) which feels like a very wrong way to go about linking with other libraries considering CMake is supposed to make the finding libraries part easier. I would appreciate clarification of the workflow in this case. Thanks, Saad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Explanation of the CMake INSTALL and EXPORT Commands
Hi, I am having a hard time understanding some commands in CMake which by the looks of it are vital for proper project deployment. One of the commands is INSTALL and the other is EXPORT. I have read the following page many times: http://www.cmake.org/Wiki/CMake:Install_Commands. The article states CMake has an elaborate install process that simplifies installation of programs, libraries, and other files. but does not go into any further detail on how it simplifies the process. But it seems like the article is meant for CMake veterans and not newcomers. It simply explains the usage of the command but not what it does, its end result and its usage. I have the following questions: 1) Why do I need to install my library/executable? When I build my libraries and they are put in their library output paths, what is the point of INSTALL? 2) Once I do install targets and/or programs, are they available to other projects that are not in the same CMakeLists build? 3) Suppose I have 2 completely separate projects (i.e. they have completely separate CMakeLists that are not 'talking' to each other) - Project A builds some libraries which Project B now needs to use. Does Project A 'install' the libraries and are now those libraries are available system wide? Or do I still have to give the path of Project A to Project B for linking? Perhaps I am not making any sense whatsoever. I apologize, but I have spent the past week trying to wrap my head around INSTALL and EXPORT but they make no sense to me because their end-usage is not described anywhere. 4) Project A can build 32 bit and 64 bit libraries. How does INSTALL (or EXPORT? Like I said earlier, I am very confused here...) know which library it is 'installing'? And then how does Project B 32 bit know to link with Project A 32 bit libraries and same with 64-bit? Thank you for any help, Saad -- 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] Explanation of the CMake INSTALL and EXPORT Commands
On 2013-04-03 16:16, Saad Khattak wrote: I am having a hard time understanding some commands in CMake which by the looks of it are vital for proper project deployment. One of the commands is INSTALL and the other is EXPORT. There are two forms of EXPORT, and I am not certain which one you are referring to. There is the command EXPORT, and there is the EXPORT named argument to the INSTALL command. They are similar in that they both deal with generating target export files, but the command version is used to generate such for build trees, while the named argument version applies to install trees. If you never use your software downstream from a build directory, you can safely ignore the command version. 1) Why do I need to install my library/executable? When I build my libraries and they are put in their library output paths, what is the point of INSTALL? INSTALL is used to implement 'make install' (or equivalent), and also packaging. If you are only ever using your software from a source build, you can probably ignore it. If you ever want to deploy your software, however, I would strongly encourage having an install process. Installing makes a software package generally available to users of the system, by installing its components into a well-known prefix (e.g. /usr, /usr/local, /opt/MySoft). It is often much more convenient to use an installed software package rather than stuff in a build directory, as installed binaries tend to be in e.g. PATH, whereas build directories may not be readable by all users. Please don't teach your build to write its build objects directly into e.g. /usr/local/bin :-). 2) Once I do install targets and/or programs, are they available to other projects that are not in the same CMakeLists build? Yes. They are available just from build directories also, but you will need to manually tell CMake where to find build directories. (Per above, installed packages can be found automatically if they are installed to standard (well known) locations... keeping in mind that you can choose to install to any location you like, e.g. in your home directory.) (If you are using exported targets - and you should - then you will need to use the EXPORT command to create a build-directory exported targets file. Getting this right is a little more complicated than install exports, but saves needing to install the package every time your downstream needs an updated version.) 3) Suppose I have 2 completely separate projects (i.e. they have completely separate CMakeLists that are not 'talking' to each other) - Project A builds some libraries which Project B now needs to use. Does Project A 'install' the libraries and are now those libraries are available system wide? If Project A is installed (to a standard location), then it is available system wide, yes. However you should still use find_package(A) rather than relying on e.g. target_link_libraries(B A) so that your build will work for users that do not have A in a standard location. If A is built by CMake, your install should generate exports so that users of A do not need a find module. (Also, then you *can* - and should - do target_link_libraries(B A), because 'A' will be an imported target, i.e. will 'look like' it was build as part of B.) 4) Project A can build 32 bit and 64 bit libraries. How does INSTALL (or EXPORT? Like I said earlier, I am very confused here...) know which library it is 'installing'? And then how does Project B 32 bit know to link with Project A 32 bit libraries and same with 64-bit? Hmm... I'm not all that familiar with multi-arch bits, but I *think* how this is supposed to work is that when B does find_package(A), it will look in either lib or lib64 depending on whether or not it is being built in 64-bit mode. So as long as your find_package picks the right AConfig.cmake, all will be well (it should by default if A is installed to a standard location, and/or if necessary you can force where to find its config). Generally speaking, you should either have two separate builds of A in 32- and 64-bit mode that can be installed in parallel, or else A should produce 32- and 64-bit libraries with different names. (I would recommend the former, since that is how most software works and is less likely to give you headaches getting it to work. Also because getting CMake to build both 32- and 64-bit binaries in the same build is going to be harder than just having separate 32- and 64-bit builds.) Hope that helps. -- Matthew -- 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] Installing and Exporting for multiple configurations
Hi, I am trying my best to understand CMake's install and export commands so that separate projects are able to find libraries easily. I am having a tremendously hard time understand what CMake is doing. After 'add_library()' where the library is called 'myLib' I called the following: install(TARGETS myLib DESTINATION ${PROJECT_BINARY_DIR}/lib/ EXPORT repoA-targets ) Then in the top-level CMakeLists I added: install(EXPORT repoA-targets DESTINATION ${PROJECT_BINARY_DIR}/lib/ ) When I build my project (in Visual Studio on Windows) it dumps libraries from all configurations in the same folder which is: ${PROJECT_BINARY_DIR}/lib and over-writes the previous library file from a different configuration because they are named the same. At the same time, it actually generates a repoA-targets-debug.cmake file, but points to the now over-written library file which is of a different configuration. Why would CMake do this? Makes no sense. That is only part of the problem. Now in RepoB, I want to import the libraries. CMake documentation here: http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets states that I can do something like this: include(${PATH_OF_REPO_A_BUILD}/repoA-targets.cmake) target_link_libraries(repoBExecutable myLib) and CMake should be able to find myLib and correctly add it to the linker's properties. This does not appear to be working. CMake simply adds myLib to the linker instead of ${FULL_PATH_OF_MYLIB}/myLib. I hope that somebody can explain what I am doing wrong and how to install and export libraries properly with CMake and then successfully import and use them in another project. Thank you, Saad -- 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-commits] CMake branch, next, updated. v2.8.10.2-2709-ge33d1fa
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project CMake. The branch, next has been updated via e33d1fa4233ea4c7df6270ab622a892cde2d14f8 (commit) via 6c613b433c45efb0bb013a6bd668cbb8ac740259 (commit) via 99f7cc127a772f8c930d6045068db2645a84bba2 (commit) from a4ffd610d3738b4d2ee7d685d52a62581df1413c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e33d1fa4233ea4c7df6270ab622a892cde2d14f8 commit e33d1fa4233ea4c7df6270ab622a892cde2d14f8 Merge: a4ffd61 6c613b4 Author: Brad King brad.k...@kitware.com AuthorDate: Wed Apr 3 11:26:58 2013 -0400 Commit: CMake Topic Stage kwro...@kitware.com CommitDate: Wed Apr 3 11:26:58 2013 -0400 Merge topic 'usr-move-relocatable' into next 6c613b4 Handle usr-move without forcing absolute paths (#14041) 99f7cc1 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c613b433c45efb0bb013a6bd668cbb8ac740259 commit 6c613b433c45efb0bb013a6bd668cbb8ac740259 Author: Brad King brad.k...@kitware.com AuthorDate: Wed Apr 3 10:54:08 2013 -0400 Commit: Brad King brad.k...@kitware.com CommitDate: Wed Apr 3 11:19:47 2013 -0400 Handle usr-move without forcing absolute paths (#14041) In commit 0c727b90 (install(EXPORT): Force absolute paths for usr-move, 2013-03-08) and commit d4774140 (configure_package_config_file: force absolute paths for usr-move, 2013-01-24) we supported Linux distributions implementing the /usr move by assuming that installation to (/usr)?/lib(64)? represents a non-relocatable system package. When cross-compiling one may prepare a package for installation into a system location on a target machine but install the package files on the *host* machine inside another path for use with CMAKE_FIND_ROOT_PATH. In this case the package development files must still be relocatable. Handle /usr move with a new approach that works with relocatable files. Teach configure_package_config_file and install(EXPORT) to generate special logic in a package configuration file or targets file for installation under (/usr)?/lib(64)?. Teach the file to recognize when it is loaded through a symlink that refers to the same realpath as its original install destination. In such a case, use the original install prefix. Otherwise, compute the prefix relative to the current file location to make it relocatable. diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 393d05c..d042d5e 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -9,8 +9,6 @@ # configure_file() command when creating the NameConfig.cmake or Name-config.cmake # file for installing a project or library. It helps making the resulting package # relocatable by avoiding hardcoded paths in the installed Config.cmake file. -# NameConfig.cmake files installed under UNIX into /lib(64) or /usr/lib(64) are -# considered system packages and are not relocatable. # # In a FooConfig.cmake file there may be code like this to make the # install destinations know to the using project: @@ -176,32 +174,17 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) set(absInstallDir ${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}) endif() - # with the /usr-move, /lib(64) is a symlink to /usr/lib on Fedora, ArchLinux, Mageira and others. - # If we are installed to such a location, force using absolute paths. - set(forceAbsolutePaths FALSE) - if(${absInstallDir} MATCHES ^(/usr)?/lib(64)?/.+) -set(forceAbsolutePaths TRUE) - endif() - file(RELATIVE_PATH PACKAGE_RELATIVE_PATH ${absInstallDir} ${CMAKE_INSTALL_PREFIX} ) foreach(var ${CCF_PATH_VARS}) if(NOT DEFINED ${var}) message(FATAL_ERROR Variable ${var} does not exist) else() - if(forceAbsolutePaths) -if(IS_ABSOLUTE ${${var}}) - set(PACKAGE_${var} ${${var}}) -else() - set(PACKAGE_${var} ${CMAKE_INSTALL_PREFIX}/${${var}}) -endif() + if(IS_ABSOLUTE ${${var}}) +string(REPLACE ${CMAKE_INSTALL_PREFIX} \${PACKAGE_PREFIX_DIR} +PACKAGE_${var} ${${var}}) else() -if(IS_ABSOLUTE ${${var}}) - string(REPLACE ${CMAKE_INSTALL_PREFIX} \${PACKAGE_PREFIX_DIR} - PACKAGE_${var} ${${var}}) -else() - set(PACKAGE_${var} \${PACKAGE_PREFIX_DIR}/${${var}}) -endif() +set(PACKAGE_${var} \${PACKAGE_PREFIX_DIR}/${${var}}) endif() endif() endforeach() @@ -216,6 +199,21 @@
[Cmake-commits] CMake branch, master, updated. v2.8.10.2-975-g00ef90e
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project CMake. The branch, master has been updated via 00ef90ec5eaa0c005a167eba64d6956293747ac6 (commit) via bec8e64c735f8953bfe4b26a886add17f11fe440 (commit) from 99f7cc127a772f8c930d6045068db2645a84bba2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00ef90ec5eaa0c005a167eba64d6956293747ac6 commit 00ef90ec5eaa0c005a167eba64d6956293747ac6 Merge: 99f7cc1 bec8e64 Author: Brad King brad.k...@kitware.com AuthorDate: Wed Apr 3 11:42:50 2013 -0400 Commit: CMake Topic Stage kwro...@kitware.com CommitDate: Wed Apr 3 11:42:50 2013 -0400 Merge topic 'qt4-pthread' bec8e64 Qt4: Fix typo setting a variable for FindThreads. --- Summary of changes: Modules/Qt4ConfigDependentSettings.cmake |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits
[Cmake-commits] CMake branch, next, updated. v2.8.10.2-2711-gd4d5d2f
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project CMake. The branch, next has been updated via d4d5d2f1b68ca1657af85f74c0084651e72fd446 (commit) via 00ef90ec5eaa0c005a167eba64d6956293747ac6 (commit) from e33d1fa4233ea4c7df6270ab622a892cde2d14f8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4d5d2f1b68ca1657af85f74c0084651e72fd446 commit d4d5d2f1b68ca1657af85f74c0084651e72fd446 Merge: e33d1fa 00ef90e Author: Brad King brad.k...@kitware.com AuthorDate: Wed Apr 3 11:42:48 2013 -0400 Commit: Brad King brad.k...@kitware.com CommitDate: Wed Apr 3 11:42:48 2013 -0400 Merge branch 'master' into next --- Summary of changes: hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits