[cmake-developers] Introducing: message(DEBUG)
I have a small patch to CMake that looks like this: diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index e1dbf34..ad24368 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -52,6 +52,18 @@ bool cmMessageCommand status = true; ++i; } + else if (*i == DEBUG) +{ +if (!this-Makefile-GetCMakeInstance()-GetDebugOutput()) + { + if (!this-Makefile-IsOn(CMAKE_DEBUG_MESSAGES)) +{ +return true; +} + } +status = true; +++i; +} for(;i != args.end(); ++i) { The idea behind this is like that: you can write message(DEBUG ...) everywhere in your CMake code and it will just print out nothing. Once you run cmake -- debug-output these messages will behave like message(STATUS), i.e. give you their contents and call trace. If at the point of the message(DEBUG) call a variable CMAKE_DEBUG_MESSAGES is set the message will behave like a normal message(STATUS), too. This variable is a completely normal CMake variable, i.e. it follows the normal scoping rules. My idea is to go into Modules/Find*.cmake and e.g. replace if(Boost_DEBUG) message(...) endif() just by CMAKE_DEBUG_MESSAGES |= Boost_DEBUG message(DEBUG ...). Opinions? Eike signature.asc Description: This is a digitally signed message part. -- 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] Introducing: message(DEBUG)
Rolf Eike Beer wrote: I have a small patch to CMake that looks like this: + if (!this-Makefile-IsOn(CMAKE_DEBUG_MESSAGES)) I propose to print message if one of the following holds: * CMAKE_DEBUG_MESSAGES is true; * CMAKE_DEBUG_MESSAGES_FileName is true, where FileName is CMAKE_CURRENT_LIST_FILE's name without extension; * Current list file is CMakeLists.txt and CMAKE_DEBUG_MESSAGES_CurrentDirectory is true. This will allow # Turn all debug messages -DCMAKE_DEBUG_MESSAGES=ON # Turn all debug messages in FindBoost.cmake -DCMAKE_DEBUG_MESSAGES_FindBoost=ON # Turn all debug messages in mysubdir/CMakeLists.txt -DCMAKE_DEBUG_MESSAGES_mysubdir=ON # Turn all debug messages in **/CMakeLists.txt -DCMAKE_DEBUG_MESSAGES_CMakeLists=ON -- Yury G. Kudryashov, mailto: ur...@mccme.ru -- 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] Two more patches
Hi! Review the following two branches in git://gitorious.org/~urkud1/cmake/urkud-cmake.git, please: * rename-used-commands; * remove-unused-members. You can either pull them or open in web browser: https://gitorious.org/~urkud1/cmake/urkud-cmake/commits/remove-unused- members https://gitorious.org/~urkud1/cmake/urkud-cmake/commits/rename-used-commands -- Yury G. Kudryashov, mailto: ur...@mccme.ru -- 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] Introducing: message(DEBUG)
Am Samstag, 3. März 2012, 17:05:11 schrieb Yury G. Kudryashov: Rolf Eike Beer wrote: I have a small patch to CMake that looks like this: + if (!this-Makefile-IsOn(CMAKE_DEBUG_MESSAGES)) I propose to print message if one of the following holds: * CMAKE_DEBUG_MESSAGES is true; * CMAKE_DEBUG_MESSAGES_FileName is true, where FileName is CMAKE_CURRENT_LIST_FILE's name without extension; * Current list file is CMakeLists.txt and CMAKE_DEBUG_MESSAGES_CurrentDirectory is true. This will allow # Turn all debug messages -DCMAKE_DEBUG_MESSAGES=ON # Turn all debug messages in FindBoost.cmake -DCMAKE_DEBUG_MESSAGES_FindBoost=ON # Turn all debug messages in mysubdir/CMakeLists.txt -DCMAKE_DEBUG_MESSAGES_mysubdir=ON # Turn all debug messages in **/CMakeLists.txt -DCMAKE_DEBUG_MESSAGES_CMakeLists=ON I'm not absolutely sure if this is worth the effort. Not that it is generally a bad idea, but it will likely require some code. The way you simply could do this stuff is to just put set(CMAKE_DEBUG_MESSAGES On) at the beginning of the subdir/module you want to debug and reset it at the end. Eike signature.asc Description: This is a digitally signed message part. -- 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] Introducing: message(DEBUG)
I have a small patch to CMake that looks like this: For easier access I pushed the topic debug-messages to stage. I don't guarantee for stability here, so I may force-push at any time. Eike signature.asc Description: This is a digitally signed message part. -- 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] Where can I get the latest version of CMake for cygwin?
On 3/2/2012 8:55 PM, Bill Hoffman wrote: On 3/2/2012 1:57 PM, Robert Dailey wrote: Latest version of CMake on the Cygwin installer is 2.8.4. I need 2.8.7. Where can I get 2.8.7 for Cygwin? We have them built, but I have been very bad at not getting them uploaded to the server. You can find them here: http://www.cmake.org/files/v2.8/cmake-2.8.7-1.tar.bz2 Bill, a simple RFU (request for upload) at cygwin-apps mailing list, with the link at your files http://www.cmake.org/files/v2.8/cmake-2.8.7-1.tar.bz2 http://www.cmake.org/files/v2.8/cmake-2.8.7-1-src.tar.bz2 will allow a larger audience and the correct deployment of your package. Thank in advance Marco -- 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] avoid rebuilding targets depending on generated source files
Hello, I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c I tried cmake -E compare_files inside execute_process, but it would not be executed before the custom command. I tried cmake -E compare_files inside a custom command as well, but that would give an error and halt the make process if the files differ. I want to avoid re-building later targets that depend on test1.c. Thanks Ajay -- 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] avoid rebuilding targets depending on generated source files
Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c Try cmake -E copy_if_different ... HS -- 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] avoid rebuilding targets depending on generated source files
Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be comparing a file with another non-existant file and that would result in an error halting the make process. Thanks Ajay On Sat, Mar 3, 2012 at 1:20 PM, Hendrik Sattler p...@hendrik-sattler.dewrote: Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c Try cmake -E copy_if_different ... HS -- 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] Install commands/shortcuts for the windows explorer
Hi, Is there an easy way to add/create a windows context menu entry with CMake/nsis? If someone has this already done before, maybe this can be explained. Thanks in advance Best Regards NoRulez -- 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] avoid rebuilding targets depending on generated source files
On 03/03/2012 10:36 PM, Ajay Panyala wrote: Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be comparing a file with another non-existant file and that would result in an error halting the make process. No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b Regards, Michael On Sat, Mar 3, 2012 at 1:20 PM, Hendrik Sattler p...@hendrik-sattler.dewrote: Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c Try cmake -E copy_if_different ... HS -- 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] avoid rebuilding targets depending on generated source files
No, it wouldn't; Thanks. It works now. I might have done something wrong earlier. - Ajay On Sat, Mar 3, 2012 at 2:47 PM, Michael Hertling mhertl...@online.dewrote: On 03/03/2012 10:36 PM, Ajay Panyala wrote: Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be comparing a file with another non-existant file and that would result in an error halting the make process. No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b Regards, Michael On Sat, Mar 3, 2012 at 1:20 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c Try cmake -E copy_if_different ... HS -- 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] Problems with CMake and static Qt plugins
On 03/02/2012 02:48 PM, NoRulez wrote: Hello, I use Qt 4.8.0 from the QtSDK and Iwant to generate a static qt plugin. In my main.cpp I have the following: #includeQApplication #includeQtPlugin Q_IMPORT_PLUGIN(Local) intmain(intargc,char*argv[]){ QApplicationapp(argc,argv); . . . return app.exec(); } The corresponding CMakeLists.txt for the LocalPlugin looks like the following: SET(LOCALPLUGIN_HEADERS LocalPlugin.h ) SET(LOCALPLUGIN_SOURCES LocalPlugin.cpp ) SET(QT_USE_QTGUITRUE) SET(QT_USE_QTPLUGINTRUE) QT4_AUTOMOC(${LOCALPLUGIN_SOURCES}) QT4_WRAP_CPP(LOCALPLUGIN_MOC${LOCALPLUGIN_HEADERS}) ADD_LIBRARY(Local STATIC ${LOCALPLUGIN_HEADERS} ${LOCALPLUGIN_SOURCES} ${LOCALPLUGIN_MOC}) TARGET_LINK_LIBRARIES(Local ${QT_LIBRARIES}) The corresponding CMakeLists.txt for the main app looks like the following: SET(QT_USE_QTMAINTRUE) SET(QT_USE_QTGUI TRUE) ADD_EXECUTABLE(MyApp WIN32 ${APP_SOURCES} ${APP_RCC} MyApp.rc) TARGET_LINK_LIBRARIES(MyAppLocal ${QT_LIBRARIES}) When I compile it I get the following error: In function `StaticLocalPluginInstance': undefined reference to `qt_plugin_instance_Local()' Please, could anybody help me to get it working? Did you INCLUDE(${QT_USE_FILE}) in the correct place, i.e. after setting the QT_USE_QT* variables? QT_LIBRARIES is populated in that file. Moreover, the lines SET(QT_USE_QTGUITRUE) SET(QT_USE_QTMAINTRUE) SET(QT_USE_QTPLUGINTRUE) QT4_WRAP_CPP(LOCALPLUGIN_MOC${LOCALPLUGIN_HEADERS}) are obviously missing blanks - just typos in your report? 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
Re: [CMake] avoid rebuilding targets depending on generated source files
No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b It works with one file, but I have 4 files that are generated. I have 4 cmake -E copy_if_different commands, one for each file. Only the last file is not copied (if similar). The others are copied even if they are the same. I verfied that they are the same with a diff. Any idea what might be happening here ? Thank You Ajay On Sat, Mar 3, 2012 at 2:47 PM, Michael Hertling mhertl...@online.dewrote: On 03/03/2012 10:36 PM, Ajay Panyala wrote: Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be comparing a file with another non-existant file and that would result in an error halting the make process. No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b Regards, Michael On Sat, Mar 3, 2012 at 1:20 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c Try cmake -E copy_if_different ... HS -- 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] avoid rebuilding targets depending on generated source files
On 03/04/2012 12:14 AM, Ajay Panyala wrote: No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b It works with one file, but I have 4 files that are generated. I have 4 cmake -E copy_if_different commands, one for each file. Only the last file is not copied (if similar). The others are copied even if they are the same. I verfied that they are the same with a diff. Any idea what might be happening here ? Please provide a minimal but complete example for this issue. Regards, Michael On Sat, Mar 3, 2012 at 2:47 PM, Michael Hertling mhertl...@online.dewrote: On 03/03/2012 10:36 PM, Ajay Panyala wrote: Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be comparing a file with another non-existant file and that would result in an error halting the make process. No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b Regards, Michael On Sat, Mar 3, 2012 at 1:20 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c Try cmake -E copy_if_different ... HS -- 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] avoid rebuilding targets depending on generated source files
Please provide a minimal but complete example for this issue. Please find it in the following link http://pastie.org/private/pd13u33s9xpfihf2dbzc1q Thank You Ajay On Sat, Mar 3, 2012 at 3:54 PM, Michael Hertling mhertl...@online.dewrote: On 03/04/2012 12:14 AM, Ajay Panyala wrote: No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b It works with one file, but I have 4 files that are generated. I have 4 cmake -E copy_if_different commands, one for each file. Only the last file is not copied (if similar). The others are copied even if they are the same. I verfied that they are the same with a diff. Any idea what might be happening here ? Please provide a minimal but complete example for this issue. Regards, Michael On Sat, Mar 3, 2012 at 2:47 PM, Michael Hertling mhertl...@online.de wrote: On 03/03/2012 10:36 PM, Ajay Panyala wrote: Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be comparing a file with another non-existant file and that would result in an error halting the make process. No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b Regards, Michael On Sat, Mar 3, 2012 at 1:20 PM, Hendrik Sattler p...@hendrik-sattler.de wrote: Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom command that moves the generated *test1.c * to a new directory inside the build directory. ADD_CUSTOM_COMMAND( TARGET TestGen POST_BUILD COMMAND mv ARGS ${PROJECT_BINARY_DIR}/test1.c ${PROJECT_BINARY_DIR}/tests/ ) Each time I run make, the custom target is run (since custom targets are always out-of-date). But I want to avoid moving the new test1.c generated each time if build/test1.c is the same as build/tests/test1.c since there are other targets like add_executable and add_library later in the CMakelists file that are re-built each time since they depend on test1.c Try cmake -E copy_if_different ... HS -- 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 -- Ajay Panyala | Email: a...@csc.lsu.edu Department of Computer Science | Phone: +1 (225) 907 9501 Louisiana State University | www.csc.lsu.edu/~ajay -- 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] Transitive library dependencies with parallel builds
On 02/29/2012 05:35 PM, Number Cruncher wrote: Do transitive dependencies reduce number of jobs that can be compiled in parallel? If I have two libraries A and B, with an executable C, whose dependencies are described by: add_library(A ${A_SRC}) add_library(B ${B_SRC}) target_link_libraries(B A) add_executable(C ${C_SRC}) target_link_libraries(C B) I understand that when *linking* C, the transitive dependency A will be added. However, if I build C in parallel make -j N, will CMake build libraries A and B simultaneously, or fully compile and link A before starting compilation of B? I.e. just because the link steps are serial dependencies, are the compilation steps? Would it be faster to do: add_library(A ${A_SRC}) add_library(B ${B_SRC}) add_executable(C ${C_SRC}) target_link_libraries(C B A) Thanks. Look at the following exemplary project: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(P C) FILE(WRITE ${CMAKE_BINARY_DIR}/a.c void a(void){}\n) FILE(WRITE ${CMAKE_BINARY_DIR}/b.c void b(void){a();}\n) FILE(WRITE ${CMAKE_BINARY_DIR}/c.c int main(void){b(); return 0;}\n) ADD_LIBRARY(A SHARED a.c) ADD_LIBRARY(B SHARED b.c) ADD_EXECUTABLE(C c.c) IF(TRANSITIVE) TARGET_LINK_LIBRARIES(B A) TARGET_LINK_LIBRARIES(C B) ELSE() TARGET_LINK_LIBRARIES(C B A) ENDIF() Configure with -DTRANSITIVE=ON and inspect CMakeFiles/Makefile2: CMakeFiles/A.dir/all: CMakeFiles/B.dir/all: CMakeFiles/A.dir/all CMakeFiles/C.dir/all: CMakeFiles/B.dir/all With -DTRANSITIVE=OFF, these lines read: CMakeFiles/A.dir/all: CMakeFiles/B.dir/all: CMakeFiles/C.dir/all: CMakeFiles/A.dir/all CMakeFiles/C.dir/all: CMakeFiles/B.dir/all The CMakeFiles/X.dir/all targets do: $(MAKE) -f CMakeFiles/X.dir/build.make CMakeFiles/X.dir/build Finally, CMakeFiles/X.dir/build in CMakeFiles/X.dir/build.make does build target X completely, i.e. including the linking step. Thus, the two-part transitive linking with -DTRANSITIVE=ON indeed completes A before addressing B, so A and B can not be compiled in parallel. In contrast, the one-part non-transitive linking with -D TRANSITIVE=OFF allows for A and B to be compiled and even linked in parallel since they haven't any interdependencies. So, with -j, the latter is potentially faster than the former, but... ...reconsider what you're about to do: If B actually references A, you might possibly not want to drop the TARGET_LINK_LIBRARIES(B A) command. Run readelf -d libB.so on both results for -DTRANSITIVE and you will see the difference. If A and B were static libraries, CMake would lose the awareness that B must pull in A in the linker command line. In short, the answers to your questions are: N/Y, Y and Y. 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
[Cmake-commits] CMake branch, master, updated. v2.8.7-559-g76bff60
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 76bff6029222449e0194b9348ac146ab8adfe4e9 (commit) from ac2979e4b36577e10b2180624050e600179a53da (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=76bff6029222449e0194b9348ac146ab8adfe4e9 commit 76bff6029222449e0194b9348ac146ab8adfe4e9 Author: KWSys Robot kwro...@kitware.com AuthorDate: Sun Mar 4 00:01:11 2012 -0500 Commit: KWSys Robot kwro...@kitware.com CommitDate: Sun Mar 4 00:05:09 2012 -0500 KWSys Nightly Date Stamp diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index e424fec..92b9f64 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 03) +SET(KWSYS_DATE_STAMP_DAY 04) --- Summary of changes: Source/kwsys/kwsysDateStamp.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