Re: [cmake-developers] [CMake] What is the current situation for adding %config (no replace)?
Thanks Eric, please see following embedded comments. On Thu, Jun 21, 2012 at 10:32 PM, Eric Noulard eric.noul...@gmail.comwrote: 2012/6/21 hce jupiter@gmail.com: Hi, There were some discussions to fix %config at http://public.kitware.com/Bug/view.php?id=10294. But I tried to use CPACK_RPM_SPEC_IGNORE_FILES in 2.8.8, it does not seem work. What is current situation to use %config? This should definitely work in 2.8.8 for RPM, however the variable you must use is, CPACK_RPM_USER_FILELIST. CPACK_RPM_SPEC_IGNORE_FILES was a too specific name. cpack --help-variable CPACK_RPM_USER_FILELIST cpack version 2.8.8.20120619-g5443 CPACK_RPM_USER_FILELIST CPACK_RPM_COMPONENT_USER_FILELIST Mandatory : NO Default : - May be used to explicitly specify %(directive) file line in the spec file. Like %config(noreplace) or any other directive that be found in the %files section. Since CPackRPM is generating the list of files (and directories) the user specified files of the CPACK_RPM_COMPONENT_USER_FILELIST list will be removed from the generated list. so set(CPACK_RPM_USER_FILELIST %config(noreplace)/etc/myconf) will make /etc/myconf a config + noreplace file in the RPM and remove that file from the automatic handling machinery of CPackRPM. Even if the RPM variable works for %config, how can the no replace files work for other package such as debian? Is there a generic solution for no replace files? Currently there is no generic solution. At least some CPack generators like Archive Generators (ZIP, TGZ, ...) won't be able to support such feature but we can try to design a generic interface (may be extending CMake install command) knowing that not all CPack generators will be able to support the feature. It will be great if CMake install command can be extended to support no replace files as it will not just beneficial for supporting different packages at least for Linux packages, but it can also be used by running installation as well. We can try to discuss the need and the possible solutions on cmake-developer mailing list if you want. -- Erk Le gouvernement représentatif n'est pas la démocratie -- http://www.le-message.org Cheers. Jupiter -- 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 0013348]: Cmake not finding buld program for Visual Studio Express 2012 on Win8
The following issue has been SUBMITTED. == http://public.kitware.com/Bug/view.php?id=13348 == Reported By:ergo1 Assigned To: == Project:CMake Issue ID: 13348 Category: CMake Reproducibility:always Severity: block Priority: normal Status: new == Date Submitted: 2012-06-22 13:13 EDT Last Modified: 2012-06-22 13:13 EDT == Summary:Cmake not finding buld program for Visual Studio Express 2012 on Win8 Description: CMake Error: CMake was unable to find a build program corresponding to Visual Studio 11. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: Could not find cmake module file:E:/W8/BUILDS/ogrewinrt/CMakeFiles/CMakeCCompiler.cmake CMake Error: Could not find cmake module file:E:/W8/BUILDS/ogrewinrt/CMakeFiles/CMakeCXXCompiler.cmake Configuring incomplete, errors occurred! Steps to Reproduce: Try to make a sample Ogre3d project on Win8 for Visual Studio Express 2012 RC. Same error with either the 32 or 64 bit build tool selection Additional Information: Code developer advised: 2. You need patched CMake 2.8.7 from Feb 23 2012 or later for VS_WINRT_EXTENSIONS and VS_WINRT_REFERENCES special target properties. My understanding is that this patch was incorporated into Cmake 2.8.8 (??) PS: Code tested OK with above noted version of cmake on win8 consumer preview with Visual Studio 11 Ultimate Beta == Issue History Date ModifiedUsername FieldChange == 2012-06-22 13:13 ergo1 New Issue == -- 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] Ninja/Win32: Negating UsingMinGW default to support Windows hosted cross compilers
Hi list, Current CMake Ninja generator will translate backslashes in the path into forward slashes iff you are using MinGW(= Windows hosted Windows compiler). I feel this behavior should be default because Windows hosted cross-compilers -- Android NDK for example -- also require this path translation but they never recognized as MinGW. Attached patch implements this and my life became much happier with CMake+Ninja :) I think this change would break non-MSVC and non-GNU toolchain (e.g. bcc32) though. (To implement it precisely, every Ninja generator has to know whether to escape response file which will feed to the compiler/linker/... I posted around this before at Ninja-build group: https://groups.google.com/d/msg/ninja-build/KrxvzcSJQbY/140CDdXKGVIJ Of course, current workaround; not to use backslashes in the filenames for MinGW; is smart enough but it would break if user fed too many -D options to the compiler and rspfile used.) Any thoughts? -- oku 0001-Ninja-win32-Negate-UsingMinGW-default.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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Ninja/Win32: Negating UsingMinGW default to support Windows hosted cross compilers
You are right, in general backslashes as path separator are not needed on windows except for cmd.ex cd buildin. It is a quote character in strings and make always trouble on bash and make! Claus On 22.06.2012, at 20:15, OKUMURA Yuki wrote: Hi list, Current CMake Ninja generator will translate backslashes in the path into forward slashes iff you are using MinGW(= Windows hosted Windows compiler). I feel this behavior should be default because Windows hosted cross-compilers -- Android NDK for example -- also require this path translation but they never recognized as MinGW. Attached patch implements this and my life became much happier with CMake+Ninja :) I think this change would break non-MSVC and non-GNU toolchain (e.g. bcc32) though. (To implement it precisely, every Ninja generator has to know whether to escape response file which will feed to the compiler/linker/... I posted around this before at Ninja-build group: https://groups.google.com/d/msg/ninja-build/KrxvzcSJQbY/140CDdXKGVIJ Of course, current workaround; not to use backslashes in the filenames for MinGW; is smart enough but it would break if user fed too many -D options to the compiler and rspfile used.) Any thoughts? -- oku 0001-Ninja-win32-Negate-UsingMinGW-default.patch-- 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 -- 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] Strange behavior with Nightly builds
Hello Richard, What is the configured cutoff time for Nightly runs?Did you mean the nightly build time? During which hours does the "continuous" builder run?Between 6 am and 10 pm When does the "nightly" builder run?Nightly build time is configured for 23:00 UTC (11 pm) Which builds do you expect to be posted to "continuous"?At 10 pm and at 6 pm in the morning (next day) the commit should be e.g. 48 Which builds do you expect to be posted to "nightly"?At 11 pm the commit should be e.g. 48 (HEAD revision) which means the last commit from the current daye.g.: If the last commit from the 21.06.2012 is at 12:30 am and has the commit 32, then the nightly build from the 21.06.2012 at 23:00 (11 pm) has (should have) the commit 32 too.The only difference is that the nightly builds starts from an empty build directory (the directory content are removed).Thanks in advanceBest RegardsAm 21. Jun 2012 um 20:20 schrieb Richard Wackerbarth rich...@nfsnet.org:From reading this, I get the distinct impression that your are not interpreting the meaning of "nightly" in the same way that the rest of us are doing so. Let's assume the following: At 15 minutes past each hour, a new commit is added to the repository. For the sake of description, the "zeroth" commit happens at 12:15 AM on June 21 Commit #1 is at 1:15 AM, ... Commit #18 is at 6:15 PM, ... Commit #22 is at 10:15 PM, Commit #23 is at 11:15 PM, Commit #24 is at 12:15 AM on June 22 ... Commit #47 is at 11:15 PM, Commit #48 is at 12:15 AM on June 23 ... etc. Further, assume that a build requires 5 minutes to run. === Now it terms of those assumptions, please tell me: What is the configured cutoff time for Nightly runs? During which hours does the "continuous" builder run? When does the "nightly" builder run? Which builds do you expect to be posted to "continuous"? Which builds do you expect to be posted to "nightly"? === With those answers, perhaps I will be able to understand what you expect and help explain how you might achieve it. Richard On Jun 21, 2012, at 1:29 AM, NoRulez wrote: Has no one an idea on how to do so or is such functionality missing?Thanks in advanceBest Regards Am 15. Jun 2012 um 08:38 schrieb NoRulez noru...@me.com:Hello David,but the problem is, that the timestamp is one day behind, so this doesn't work and I get previous revisions. (Our nightly build starts at 23:00 and not at 1 am) However is there a way to update to the HEAD revision?Best Regards -- 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] Text user configuration (features, flags) that is more persistent than cache?
Hi, What is mentioned here has been implemented in our configuration system (CMT previously implemented in pure C++/make and currently re-implemented on top of CMake) The principle is to add on top of the build system (say CMake, but this could be plain make, or Waf) a layer that describes the configuration of your software project in terms of: - structure (directory structure and functional relationships ie. the use relationships) as a graph of projects and packages - constituents (libs, apps, generated docs) and their sources - parameters for both the build, the packaging and the run - conditions (tags, contexts) that could be used to select operational situations This configuration used to be described in a text file (per package + per project) filling in a in-memory-database, used to setup the various build tools, as well as the production tools and to offer query features to the developer/user. Nowadays, this approach is being re-implemented using the CMake language to profit its multiplatform paralellism capacity. This approach answers the point you raise here, but also another recent point on the a-priori knowledge of what/where/how is available in a given possible large software base. I would love that the database approach would be natively offered by CMake (thus offering the pre/post build query facilities) http://www.cmtsite.org/ git://github.com/ChristianArnault/CMT.git Regards, Christian Le 21/06/2012 22:25, Ateljevich, Eli a écrit : Hi, I was wondering if there is a best practice for providing a file for user configuration decisions (options, unique flags) that will be more persistent than the cache? I have a project where a dozen or two algorithmic decisions have to be made. I find that this is just enough that cache overwrites cause me fear. I could do this on the environment, I suppose, but most of my users prefer a small list of name-value pairs for decisions that are pretty stable for them. I couldn't find anything on this. The concept is alluded to by a 2001 email about INCLUDE by Bill Hoffman: It could be used like this: INCLUDE (${PROJECT_BINARY_DIR}/UserCacheSettings.txt OPTIONAL) This would allow the user to pre-set values for the Cache file, but still be able to delete the Cache file. But I wasn't sure about the mechanics of this. When would it have to be read to fulfill this role and what does pre-set really mean in light of that as far as precedence if there are duplicate entries? Wouldn't everything that could be set have to be something that will also appear in CMakeCache.txt? I assume the format would be just like CMakeCache.txt? ...which would be ideal. Thanks, Eli -- 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 -- | Christian Arnault| | LAL Bat 200 pièce 03a| | 91405 Orsay CEDEX| | phone : (33) 1 64 46 84 24 | | gsm : (33) 6 77 27 62 30 | | fax : (33) 1 69 07 94 04 | | e-mail : christian.arna...@lal.in2p3.fr | -- 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] SHARED library containing OBJECT library: Missing -fPIC
Hello, I have a problem using an OBJECT library that I want to compile into a SHARED library using CMake version 2.8.8. Here is a small example that demonstrates my problem: # --- CMakeLists.txt --- cmake_minimum_required(VERSION 2.8.8) project(CMakeTest CXX) add_library(MyLibSub OBJECT ClassA.cpp ) add_library(MyLib SHARED $TARGET_OBJECTS:MyLibSub ClassB.cpp ) The content of the other four files is more or less irrelevant. To make the example complete, I added them at the end of this e-mail. When I want to build this example, I get the following error: $ mkdir build cd build cmake .. make -- The CXX compiler identification is GNU 4.7.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /home/benjamin/Desktop/CMake test/build Scanning dependencies of target MyLibSub [ 50%] Building CXX object CMakeFiles/MyLibSub.dir/ClassA.cpp.o [ 50%] Built target MyLibSub Scanning dependencies of target MyLib [100%] Building CXX object CMakeFiles/MyLib.dir/ClassB.cpp.o Linking CXX shared library libMyLib.so /usr/bin/ld: CMakeFiles/MyLibSub.dir/ClassA.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC CMakeFiles/MyLibSub.dir/ClassA.cpp.o: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [libMyLib.so] Error 1 make[1]: *** [CMakeFiles/MyLib.dir/all] Error 2 make: *** [all] Error 2 When I add the line set_target_properties(MyLibSub PROPERTIES COMPILE_FLAGS -fPIC) to the CMakeLists.txt, everything works fine. Am I doing something wrong? Should CMake add -fPIC automatically in this case? Your feedback is greatly appreciated. Kind regards Benjamin // --- ClassA.cpp --- #include ClassA.h #include iostream void ClassA::printName() { std::cout ClassA std::endl; } // --- ClassA.h --- #ifndef CLASSA_H #define CLASSA_H struct ClassA { void printName(); }; #endif /* CLASSA_H */ // --- ClassB.cpp --- #include ClassB.h #include iostream void ClassB::printName() { std::cout ClassB std::endl; a.printName(); } // --- ClassB.h --- #ifndef CLASSB_H #define CLASSB_H #include ClassA.h struct ClassB { void printName(); ClassA a; }; #endif /* CLASSB_H */ -- 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] SHARED library containing OBJECT library: Missing -fPIC
Hello Benjamin, if you wants to use an object file for a shared library, this object file has to be compiled with -fPIC. I don't think, that it is possible to create a shared library from such object files. Regards, Andreas Am 22.06.2012 09:50, schrieb Benjamin Eikel: Hello, I have a problem using an OBJECT library that I want to compile into a SHARED library using CMake version 2.8.8. Here is a small example that demonstrates my problem: # --- CMakeLists.txt --- cmake_minimum_required(VERSION 2.8.8) project(CMakeTest CXX) add_library(MyLibSub OBJECT ClassA.cpp ) add_library(MyLib SHARED $TARGET_OBJECTS:MyLibSub ClassB.cpp ) The content of the other four files is more or less irrelevant. To make the example complete, I added them at the end of this e-mail. When I want to build this example, I get the following error: $ mkdir build cd build cmake .. make -- The CXX compiler identification is GNU 4.7.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /home/benjamin/Desktop/CMake test/build Scanning dependencies of target MyLibSub [ 50%] Building CXX object CMakeFiles/MyLibSub.dir/ClassA.cpp.o [ 50%] Built target MyLibSub Scanning dependencies of target MyLib [100%] Building CXX object CMakeFiles/MyLib.dir/ClassB.cpp.o Linking CXX shared library libMyLib.so /usr/bin/ld: CMakeFiles/MyLibSub.dir/ClassA.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC CMakeFiles/MyLibSub.dir/ClassA.cpp.o: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [libMyLib.so] Error 1 make[1]: *** [CMakeFiles/MyLib.dir/all] Error 2 make: *** [all] Error 2 When I add the line set_target_properties(MyLibSub PROPERTIES COMPILE_FLAGS -fPIC) to the CMakeLists.txt, everything works fine. Am I doing something wrong? Should CMake add -fPIC automatically in this case? Your feedback is greatly appreciated. Kind regards Benjamin // --- ClassA.cpp --- #include ClassA.h #includeiostream void ClassA::printName() { std::cout ClassA std::endl; } // --- ClassA.h --- #ifndef CLASSA_H #define CLASSA_H struct ClassA { void printName(); }; #endif /* CLASSA_H */ // --- ClassB.cpp --- #include ClassB.h #includeiostream void ClassB::printName() { std::cout ClassB std::endl; a.printName(); } // --- ClassB.h --- #ifndef CLASSB_H #define CLASSB_H #include ClassA.h struct ClassB { void printName(); ClassA a; }; #endif /* CLASSB_H */ -- 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] SHARED library containing OBJECT library: Missing -fPIC
Hello Andreas, Am Freitag, 22. Juni 2012, 11:09:36 schrieb Andreas Naumann: Hello Benjamin, if you wants to use an object file for a shared library, this object file has to be compiled with -fPIC. I don't think, that it is possible to create a shared library from such object files. I know that this is the case. My question is not directed to -fPIC in general, but to CMake's handling of these files. I want to use CMake's new OBJECT library feature to structure the build of a library. The library is built statically as well as dynamically. When building statically, there is no problem in using the OBJECT libraries of CMake. But when building dynamically, the problem described in my original e-mail arises. CMake's documentation does not say that it is not allowed to use OBJECT libraries to compose shared libraries. Kind regards Benjamin Regards, Andreas Am 22.06.2012 09:50, schrieb Benjamin Eikel: Hello, I have a problem using an OBJECT library that I want to compile into a SHARED library using CMake version 2.8.8. Here is a small example that demonstrates my problem: # --- CMakeLists.txt --- cmake_minimum_required(VERSION 2.8.8) project(CMakeTest CXX) add_library(MyLibSub OBJECT ClassA.cpp ) add_library(MyLib SHARED $TARGET_OBJECTS:MyLibSub ClassB.cpp ) The content of the other four files is more or less irrelevant. To make the example complete, I added them at the end of this e-mail. When I want to build this example, I get the following error: $ mkdir build cd build cmake .. make -- The CXX compiler identification is GNU 4.7.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /home/benjamin/Desktop/CMake test/build Scanning dependencies of target MyLibSub [ 50%] Building CXX object CMakeFiles/MyLibSub.dir/ClassA.cpp.o [ 50%] Built target MyLibSub Scanning dependencies of target MyLib [100%] Building CXX object CMakeFiles/MyLib.dir/ClassB.cpp.o Linking CXX shared library libMyLib.so /usr/bin/ld: CMakeFiles/MyLibSub.dir/ClassA.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC CMakeFiles/MyLibSub.dir/ClassA.cpp.o: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [libMyLib.so] Error 1 make[1]: *** [CMakeFiles/MyLib.dir/all] Error 2 make: *** [all] Error 2 When I add the line set_target_properties(MyLibSub PROPERTIES COMPILE_FLAGS -fPIC) to the CMakeLists.txt, everything works fine. Am I doing something wrong? Should CMake add -fPIC automatically in this case? Your feedback is greatly appreciated. Kind regards Benjamin // --- ClassA.cpp --- #include ClassA.h #includeiostream void ClassA::printName() { std::cout ClassA std::endl; } // --- ClassA.h --- #ifndef CLASSA_H #define CLASSA_H struct ClassA { void printName(); }; #endif /* CLASSA_H */ // --- ClassB.cpp --- #include ClassB.h #includeiostream void ClassB::printName() { std::cout ClassB std::endl; a.printName(); } // --- ClassB.h --- #ifndef CLASSB_H #define CLASSB_H #include ClassA.h struct ClassB { void printName(); ClassA a; }; #endif /* CLASSB_H */ -- 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 -- 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] SHARED library containing OBJECT library: Missing -fPIC
I think the latter is the case. It should not be allowed to compose a shared library from OBJECT libraries. What does the cmake developer think about this problem? Regards, Andreas Am 22.06.2012 11:14, schrieb Benjamin Eikel: Hello Andreas, Am Freitag, 22. Juni 2012, 11:09:36 schrieb Andreas Naumann: Hello Benjamin, if you wants to use an object file for a shared library, this object file has to be compiled with -fPIC. I don't think, that it is possible to create a shared library from such object files. I know that this is the case. My question is not directed to -fPIC in general, but to CMake's handling of these files. I want to use CMake's new OBJECT library feature to structure the build of a library. The library is built statically as well as dynamically. When building statically, there is no problem in using the OBJECT libraries of CMake. But when building dynamically, the problem described in my original e-mail arises. CMake's documentation does not say that it is not allowed to use OBJECT libraries to compose shared libraries. Kind regards Benjamin Regards, Andreas Am 22.06.2012 09:50, schrieb Benjamin Eikel: Hello, I have a problem using an OBJECT library that I want to compile into a SHARED library using CMake version 2.8.8. Here is a small example that demonstrates my problem: # --- CMakeLists.txt --- cmake_minimum_required(VERSION 2.8.8) project(CMakeTest CXX) add_library(MyLibSub OBJECT ClassA.cpp ) add_library(MyLib SHARED $TARGET_OBJECTS:MyLibSub ClassB.cpp ) The content of the other four files is more or less irrelevant. To make the example complete, I added them at the end of this e-mail. When I want to build this example, I get the following error: $ mkdir build cd build cmake .. make -- The CXX compiler identification is GNU 4.7.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /home/benjamin/Desktop/CMake test/build Scanning dependencies of target MyLibSub [ 50%] Building CXX object CMakeFiles/MyLibSub.dir/ClassA.cpp.o [ 50%] Built target MyLibSub Scanning dependencies of target MyLib [100%] Building CXX object CMakeFiles/MyLib.dir/ClassB.cpp.o Linking CXX shared library libMyLib.so /usr/bin/ld: CMakeFiles/MyLibSub.dir/ClassA.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC CMakeFiles/MyLibSub.dir/ClassA.cpp.o: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [libMyLib.so] Error 1 make[1]: *** [CMakeFiles/MyLib.dir/all] Error 2 make: *** [all] Error 2 When I add the line set_target_properties(MyLibSub PROPERTIES COMPILE_FLAGS -fPIC) to the CMakeLists.txt, everything works fine. Am I doing something wrong? Should CMake add -fPIC automatically in this case? Your feedback is greatly appreciated. Kind regards Benjamin // --- ClassA.cpp --- #include ClassA.h #includeiostream void ClassA::printName() { std::cout ClassA std::endl; } // --- ClassA.h --- #ifndef CLASSA_H #define CLASSA_H struct ClassA { void printName(); }; #endif /* CLASSA_H */ // --- ClassB.cpp --- #include ClassB.h #includeiostream void ClassB::printName() { std::cout ClassB std::endl; a.printName(); } // --- ClassB.h --- #ifndef CLASSB_H #define CLASSB_H #include ClassA.h struct ClassB { void printName(); ClassA a; }; #endif /* CLASSB_H */ -- 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 -- 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
Re: [CMake] Separate compiler and linker pdb
Hello, thanks for your reply. I saw that page already, and I understand cmake needs to work around other people's mistakes, so the fix is not an easy one. My doubt is not about setting a specific path, but about the pdbs ending up in the same spot. Is there any known problem with the pdbs overwriting each other? Or is that safe? Couldn't you just call them *.compiler.pdb and *.linker.pdb as a temporary fix, and leave to the user the burden of picking up the relevant ones? Michele On 21/06/2012 19:10, Yuri Timenkov wrote: This is a limitation of CMake. There is a discussion at http://public.kitware.com/Bug/view.php?id=11899 On Tue, Jun 19, 2012 at 7:57 PM, Michele Santullo michele.santu...@larian.com wrote: Hello, we recently converted our project to cmake but for some reason, as we generate for VS 2008 on Windows, we get the same path for both the compiler and the linker generated pdb files. The path is something like /bin/Debug/Project.pdb for both, so they overwrite each other causing various errors. If I pass the /Fd switch to the compiler, cmake just keeps the old path and appends the new one to the command line parameters, confusing the VS IDE and causing a full rebuild every time we build. Is there a solution to produce two different files? Could it be caused by some error in my cmake files? The only settings about paths I can think of are: set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin ) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib ) if(MSVC) set(PDB_SEARCH_PATHS /PDBPATH) SET(LNK_FLAGS_DEBUG ${LNK_FLAGS_DEBUG} ${PDB_SEARCH_PATHS}) SET(LNK_FLAGS_RELEASE ${LNK_FLAGS_RELEASE} ${PDB_SEARCH_PATHS}) SET(LNK_FLAGS_SHIPPING ${LNK_FLAGS_SHIPPING} ${PDB_SEARCH_PATHS}) endif(MSVC) Thanks, Michele -- 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] Problem with IMPORTED_LINK_INTERFACE_LIBRARIES_config
Hello, I need to add some linker dependencies to a static lib I'm importing into our project. I need to do that on a per-target basis, but the following is not working: add_library(GameNet STATIC IMPORTED) # our code built in another project and imported by the current one add_library(Library STATIC IMPORTED) # 3rd party library, source code unavailable add_library(LibraryD STATIC IMPORTED) # Debug version of the same library as above set (ALL_LIBS optimized Library debug LibraryD ) set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES ${ALL_LIBS}) Running cmake gives a message about optimized/debug keyword being forbidden in this case. The same message suggests you use IMPORTED_LINK_INTERFACE_LIBRARIES_config in this case. However, I tried the following: set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG LibraryD) set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE Library) and it just has no effect. There is no trace of Library[D] in the generated files. I'm using cmake 2.8.8 on windows for VS 9 2008. Thanks, Michele -- 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] Problem with IMPORTED_LINK_INTERFACE_LIBRARIES_config
Hi Michele, I don't know how it is in this particular case, but some configuration-specific variable, property etc. names are case-sensitive. I believe the default configuraions are called Debug and Release. You could try setting IMPORTED_LINK_INTERFACE_LIBRARIES_Debug. Petr On Fri, Jun 22, 2012 at 12:17 PM, Michele Santullo michele.santu...@larian.com wrote: Hello, I need to add some linker dependencies to a static lib I'm importing into our project. I need to do that on a per-target basis, but the following is not working: add_library(GameNet STATIC IMPORTED) # our code built in another project and imported by the current one add_library(Library STATIC IMPORTED) # 3rd party library, source code unavailable add_library(LibraryD STATIC IMPORTED) # Debug version of the same library as above set (ALL_LIBS optimized Library debug LibraryD ) set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES ${ALL_LIBS}) Running cmake gives a message about optimized/debug keyword being forbidden in this case. The same message suggests you use IMPORTED_LINK_INTERFACE_LIBRARIES_config in this case. However, I tried the following: set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG LibraryD) set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE Library) and it just has no effect. There is no trace of Library[D] in the generated files. I'm using cmake 2.8.8 on windows for VS 9 2008. Thanks, Michele -- 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] Strange behavior with Nightly builds
On Jun 22, 2012, at 2:09 AM, NoRulez wrote: Hello Richard, What is the configured cutoff time for Nightly runs? Did you mean the nightly build time? I mean this value (for example in CTestConfig.cmake) such as: set(CTEST_NIGHTLY_START_TIME 21:00:00 EDT) or set(CTEST_NIGHTLY_START_TIME 1:00:00 UTC) But let's be certain that we both are talking about the consistent times, namely UTC. During which hours does the continuous builder run? Between 6 am and 10 pm (UTC ?) (Note A) See below When does the nightly builder run? Nightly build time is configured for 23:00 UTC (11 pm) Which builds do you expect to be posted to continuous? At 10 pm and at 6 pm in the morning (next day) the commit should be e.g. 48 I interpret (Note A) to indicate that you should expect the following runs: 5, 6, 7, ... , 21, 30 - 45, 54 - 69, etc. Commit 5 is processed when the builder restarts at 6 AM. Commit 6 is processed shortly after 6:15 AM The builder shuts down for the night before Commit 22 is posted at 10:15 PM Which builds do you expect to be posted to nightly? At 11 pm the commit should be e.g. 48 (HEAD revision) which means the last commit from the current day At 11 PM, the last commit was the one made at 10:15 PM, namely 22, 46, 70, ... e.g.: If the last commit from the 21.06.2012 is at 12:30 am I don't know how you expect 12:30 AM to be the last commit of the day. The day started only 30 minutes earlier. and has the commit 32, then the nightly build from the 21.06.2012 at 23:00 (11 pm) has (should have) the commit 32 too. This doesn't make sense. (And please follow my assumptions -- all of the commits in my scenario occur at 15 minutes past the hour. There are no commits made at 12:30 am) Please draw your timeline, mark all of the actions and revise your expectations. The only difference is that the nightly builds starts from an empty build directory (the directory content are removed). A typical distinction. Thanks in advance Best Regards Am 21. Jun 2012 um 20:20 schrieb Richard Wackerbarth rich...@nfsnet.org: From reading this, I get the distinct impression that your are not interpreting the meaning of nightly in the same way that the rest of us are doing so. Let's assume the following: At 15 minutes past each hour, a new commit is added to the repository. For the sake of description, the zeroth commit happens at 12:15 AM on June 21 Commit #1 is at 1:15 AM, ... Commit #18 is at 6:15 PM, ... Commit #22 is at 10:15 PM, Commit #23 is at 11:15 PM, Commit #24 is at 12:15 AM on June 22 ... Commit #47 is at 11:15 PM, Commit #48 is at 12:15 AM on June 23 ... etc. Further, assume that a build requires 5 minutes to run. === Now it terms of those assumptions, please tell me: What is the configured cutoff time for Nightly runs? During which hours does the continuous builder run? When does the nightly builder run? Which builds do you expect to be posted to continuous? Which builds do you expect to be posted to nightly? === With those answers, perhaps I will be able to understand what you expect and help explain how you might achieve it. Richard On Jun 21, 2012, at 1:29 AM, NoRulez wrote: Has no one an idea on how to do so or is such functionality missing? Thanks in advance Best Regards Am 15. Jun 2012 um 08:38 schrieb NoRulez noru...@me.com: Hello David, but the problem is, that the timestamp is one day behind, so this doesn't work and I get previous revisions. (Our nightly build starts at 23:00 and not at 1 am) However is there a way to update to the HEAD revision? Best Regards -- 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] Strange behavior with Nightly builds
I made a minor error in my previous posting. I forgot the first run as continuous starts up on the second day. I have make the correction inline below. On Jun 22, 2012, at 2:09 AM, NoRulez wrote: Hello Richard, What is the configured cutoff time for Nightly runs? Did you mean the nightly build time? I mean this value (for example in CTestConfig.cmake) such as: set(CTEST_NIGHTLY_START_TIME 21:00:00 EDT) or set(CTEST_NIGHTLY_START_TIME 1:00:00 UTC) But let's be certain that we both are talking about the consistent times, namely UTC. During which hours does the continuous builder run? Between 6 am and 10 pm (UTC ?) (Note A) See below When does the nightly builder run? Nightly build time is configured for 23:00 UTC (11 pm) Which builds do you expect to be posted to continuous? At 10 pm and at 6 pm in the morning (next day) the commit should be e.g. 48 I interpret (Note A) to indicate that you should expect the following runs: 5, 6, 7, ... , 21, 29 - 45, 53 - 69, etc. Commit 5 is processed when the builder restarts at 6 AM. Commit 6 is processed shortly after 6:15 AM The builder shuts down for the night before Commit 22 is posted at 10:15 PM Which builds do you expect to be posted to nightly? At 11 pm the commit should be e.g. 48 (HEAD revision) which means the last commit from the current day At 11 PM, the last commit was the one made at 10:15 PM, namely 22, 46, 70, ... e.g.: If the last commit from the 21.06.2012 is at 12:30 am I don't know how you expect 12:30 AM to be the last commit of the day. The day started only 30 minutes earlier. and has the commit 32, then the nightly build from the 21.06.2012 at 23:00 (11 pm) has (should have) the commit 32 too. This doesn't make sense. (And please follow my assumptions -- all of the commits in my scenario occur at 15 minutes past the hour. There are no commits made at 12:30 am) Please draw your timeline, mark all of the actions and revise your expectations. The only difference is that the nightly builds starts from an empty build directory (the directory content are removed). A typical distinction. Thanks in advance Best Regards Am 21. Jun 2012 um 20:20 schrieb Richard Wackerbarth rich...@nfsnet.org: From reading this, I get the distinct impression that your are not interpreting the meaning of nightly in the same way that the rest of us are doing so. Let's assume the following: At 15 minutes past each hour, a new commit is added to the repository. For the sake of description, the zeroth commit happens at 12:15 AM on June 21 Commit #1 is at 1:15 AM, ... Commit #18 is at 6:15 PM, ... Commit #22 is at 10:15 PM, Commit #23 is at 11:15 PM, Commit #24 is at 12:15 AM on June 22 ... Commit #47 is at 11:15 PM, Commit #48 is at 12:15 AM on June 23 ... etc. Further, assume that a build requires 5 minutes to run. === Now it terms of those assumptions, please tell me: What is the configured cutoff time for Nightly runs? During which hours does the continuous builder run? When does the nightly builder run? Which builds do you expect to be posted to continuous? Which builds do you expect to be posted to nightly? === With those answers, perhaps I will be able to understand what you expect and help explain how you might achieve it. Richard On Jun 21, 2012, at 1:29 AM, NoRulez wrote: Has no one an idea on how to do so or is such functionality missing? Thanks in advance Best Regards Am 15. Jun 2012 um 08:38 schrieb NoRulez noru...@me.com: Hello David, but the problem is, that the timestamp is one day behind, so this doesn't work and I get previous revisions. (Our nightly build starts at 23:00 and not at 1 am) However is there a way to update to the HEAD revision? Best Regards -- 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] Problem with IMPORTED_LINK_INTERFACE_LIBRARIES_config
Thanks for the suggestion. We just tried that but unfortunately it doesn't change anything. Using IMPORTED_LINK_INTERFACE_LIBRARIES adds the library to every target build, but either IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG and IMPORTED_LINK_INTERFACE_LIBRARIES_Debug seem to be just ignored. There are not even cmake messages at generation time. Of course we have a target named Debug: SET(CMAKE_CONFIGURATION_TYPES Debug Release Shipping CACHE TYPE INTERNAL FORCE) Michele On 06/22/2012 01:10 PM, Petr Kmoch wrote: Hi Michele, I don't know how it is in this particular case, but some configuration-specific variable, property etc. names are case-sensitive. I believe the default configuraions are called Debug and Release. You could try setting IMPORTED_LINK_INTERFACE_LIBRARIES_Debug. Petr On Fri, Jun 22, 2012 at 12:17 PM, Michele Santullo michele.santu...@larian.com wrote: Hello, I need to add some linker dependencies to a static lib I'm importing into our project. I need to do that on a per-target basis, but the following is not working: add_library(GameNet STATIC IMPORTED) # our code built in another project and imported by the current one add_library(Library STATIC IMPORTED) # 3rd party library, source code unavailable add_library(LibraryD STATIC IMPORTED) # Debug version of the same library as above set (ALL_LIBS optimized Library debug LibraryD ) set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES ${ALL_LIBS}) Running cmake gives a message about optimized/debug keyword being forbidden in this case. The same message suggests you use IMPORTED_LINK_INTERFACE_LIBRARIES_config in this case. However, I tried the following: set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG LibraryD) set_target_properties(GameNet PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE Library) and it just has no effect. There is no trace of Library[D] in the generated files. I'm using cmake 2.8.8 on windows for VS 9 2008. Thanks, Michele -- 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] Return code from CMake script
Hi, Perhaps this is a trivial question. Is there a way to return a specific error code from a CMake script ( -P file option)? The only way I know to return a failure is by calling message(FATAL_ERROR ...) and this returns rc = 1, but I would like to return the error I got from the underlying process execution. Cheers, Pere - Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland e-mail: pere.m...@cern.ch tel: +41 22 76 78696 fax: +41 22 76 68792gsm: +41 76 48 70855 -- 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] SHARED library containing OBJECT library: Missing -fPIC
I tried this in my project. I added -fPIC to the COMPILE_FLAGS property of the object library and it worked, but then you also get PIC static libraries (which isn't that big of a deal). But time your compiles. Usually the compilation of individual c files is well dominated by the linking time, especially with optimization. So to reduce technical risk, I opted just to build each library the old fashioned way and compile objects twice. I saw pretty much no compile time difference. But maybe you have other reasons. Sent from my iPhone On Jun 22, 2012, at 5:46, Andreas Naumann andreas-naum...@gmx.net wrote: I think the latter is the case. It should not be allowed to compose a shared library from OBJECT libraries. What does the cmake developer think about this problem? Regards, Andreas Am 22.06.2012 11:14, schrieb Benjamin Eikel: Hello Andreas, Am Freitag, 22. Juni 2012, 11:09:36 schrieb Andreas Naumann: Hello Benjamin, if you wants to use an object file for a shared library, this object file has to be compiled with -fPIC. I don't think, that it is possible to create a shared library from such object files. I know that this is the case. My question is not directed to -fPIC in general, but to CMake's handling of these files. I want to use CMake's new OBJECT library feature to structure the build of a library. The library is built statically as well as dynamically. When building statically, there is no problem in using the OBJECT libraries of CMake. But when building dynamically, the problem described in my original e-mail arises. CMake's documentation does not say that it is not allowed to use OBJECT libraries to compose shared libraries. Kind regards Benjamin Regards, Andreas Am 22.06.2012 09:50, schrieb Benjamin Eikel: Hello, I have a problem using an OBJECT library that I want to compile into a SHARED library using CMake version 2.8.8. Here is a small example that demonstrates my problem: # --- CMakeLists.txt --- cmake_minimum_required(VERSION 2.8.8) project(CMakeTest CXX) add_library(MyLibSub OBJECT ClassA.cpp ) add_library(MyLib SHARED $TARGET_OBJECTS:MyLibSub ClassB.cpp ) The content of the other four files is more or less irrelevant. To make the example complete, I added them at the end of this e-mail. When I want to build this example, I get the following error: $ mkdir build cd build cmake .. make -- The CXX compiler identification is GNU 4.7.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /home/benjamin/Desktop/CMake test/build Scanning dependencies of target MyLibSub [ 50%] Building CXX object CMakeFiles/MyLibSub.dir/ClassA.cpp.o [ 50%] Built target MyLibSub Scanning dependencies of target MyLib [100%] Building CXX object CMakeFiles/MyLib.dir/ClassB.cpp.o Linking CXX shared library libMyLib.so /usr/bin/ld: CMakeFiles/MyLibSub.dir/ClassA.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC CMakeFiles/MyLibSub.dir/ClassA.cpp.o: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [libMyLib.so] Error 1 make[1]: *** [CMakeFiles/MyLib.dir/all] Error 2 make: *** [all] Error 2 When I add the line set_target_properties(MyLibSub PROPERTIES COMPILE_FLAGS -fPIC) to the CMakeLists.txt, everything works fine. Am I doing something wrong? Should CMake add -fPIC automatically in this case? Your feedback is greatly appreciated. Kind regards Benjamin // --- ClassA.cpp --- #include ClassA.h #includeiostream void ClassA::printName() { std::cout ClassA std::endl; } // --- ClassA.h --- #ifndef CLASSA_H #define CLASSA_H struct ClassA { void printName(); }; #endif /* CLASSA_H */ // --- ClassB.cpp --- #include ClassB.h #includeiostream void ClassB::printName() { std::cout ClassB std::endl; a.printName(); } // --- ClassB.h --- #ifndef CLASSB_H #define CLASSB_H #include ClassA.h struct ClassB { void printName(); ClassA a; }; #endif /* CLASSB_H */ -- 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
Re: [CMake] Return code from CMake script
Presently, there is no way to do that. It would be a reasonable feature request to add an EXIT_STATUS or EXIT_CODE parameter to the message command to enable this functionality. As an alternative (workaround), perhaps you could write the status value into a file that you inspect after CMake returns? HTH, David On Fri, Jun 22, 2012 at 9:24 AM, Pere Mato Vila pere.m...@cern.ch wrote: Hi, Perhaps this is a trivial question. Is there a way to return a specific error code from a CMake script ( -P file option)? The only way I know to return a failure is by calling message(FATAL_ERROR ...) and this returns rc = 1, but I would like to return the error I got from the underlying process execution. Cheers, Pere - Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland e-mail: pere.m...@cern.ch tel: +41 22 76 78696 fax: +41 22 76 68792gsm: +41 76 48 70855 -- 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] Return code from CMake script
Thanks very much for you prompt answer. As an alternative (workaround), perhaps you could write the status value into a file that you inspect after CMake returns? Unfortunately this is not possible because who calls by script is ctest. Cheers, Pere - Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland e-mail: pere.m...@cern.chmailto:pere.m...@cern.ch tel: +41 22 76 78696 fax: +41 22 76 68792gsm: +41 76 48 70855 -- 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] Return code from CMake script
On Fri, Jun 22, 2012 at 10:15 AM, Pere Mato Vila pere.m...@cern.ch wrote: Thanks very much for you prompt answer. As an alternative (workaround), perhaps you could write the status value into a file that you inspect after CMake returns? Unfortunately this is not possible because who calls by script is ctest. Then it should definitely be possible. Before calling message(FATAL_ERROR write out a file with file(WRITE to indicate the return value that you want. Then after the script is done (or after ctest_configure if you're producing the FATAL_ERROR in a CMakeLists), use file(READ in the ctest script to read the file that has the return value in it. This may or may not be too much effort for what you're trying to do, but it should certainly be possible... HTH, David Cheers, Pere - Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland e-mail: pere.m...@cern.ch tel: +41 22 76 78696 fax: +41 22 76 68792gsm: +41 76 48 70855 -- 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] Return code from CMake script
On Jun 22, 2012, at 4:25 PM, David Cole wrote: As an alternative (workaround), perhaps you could write the status value into a file that you inspect after CMake returns? Unfortunately this is not possible because who calls by script is ctest. Then it should definitely be possible. I meant ctest as the one that calls the test I have declared with add_test(). What I have is something like this: add_test(cmake -D... -P myscript.cmake) Cheers, Pere - Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland e-mail: pere.m...@cern.chmailto:pere.m...@cern.ch tel: +41 22 76 78696 fax: +41 22 76 68792gsm: +41 76 48 70855 -- 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 add dependency on parent directories?
Dependencies are between targets, not projects or CMakeLists.txt. You would need to have a target in one project depend on a target defined in another. Some of these dependencies are managed automatically, as when you build one or more libraries, and then reference them when you build a program. For example: add_library(lib1 a.cxx b.cxx c.cxx) add_executable(exec1 exec1.cxx) target_link_libraries(exec1 lib1) In this case, CMake would generate build recipes (Makefile, Visual Studio, etc) such that a.cxx,b.cxx, and c.xx would be compiled, and lib1 generated from the object files, before exec1 was linked. In the case where you want a depency that wasn't straightforward (like a library depends on it's objects, or an executable on it's objects and libraries) you can add explicit dependencies, with add_dependency. Also, if you have tests depend on other tests. This is important if one test generates a file, and a second test checks the generated file: add_test(NAME GenerateFile COMMAND generate_file) add_test(NAME TestFileContents COMMAND test_generated_file) add_property(TEST test_generated_file APPEND PROPERTY DEPENDS generate_file) On Wed, Apr 25, 2012 at 7:31 AM, Vyacheslav Karamov ubuntul...@yandex.ru wrote: Hi All! My project's (named Compare) structure is similar to this: Root | SphinX | sphinxbase (autotools project) Sound | |-DoScoring (my Cmake-based project) |-Compare (my Cmake-based project) |-CMakeLists.txt |-src (source files for project Compare) |-ATLAS (autotools project) How add dependencies on other projects to CMakeLists.txt of my project Compare? Thank you in advance, Vyacheslav. -- 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] Text user configuration (features, flags) that is more persistent than cache?
Hi Eli, On 21 June 2012 21:25, Ateljevich, Eli e...@water.ca.gov wrote: Hi, I was wondering if there is a best practice for providing a file for user configuration decisions (options, unique flags) that will be more persistent than the cache? I have a project where a dozen or two algorithmic decisions have to be made. I find that this is just enough that cache overwrites cause me fear. I could do this on the environment, I suppose, but most of my users prefer a small list of name-value pairs for decisions that are pretty stable for them. ** ** I couldn’t find anything on this. The concept is alluded to by a 2001 email about INCLUDE by Bill Hoffman: It could be used like this: ** ** INCLUDE (${PROJECT_BINARY_DIR}/UserCacheSettings.txt OPTIONAL) ** ** This would allow the user to pre-set values for the Cache file, but still* *** be able to delete the Cache file. ** ** But I wasn’t sure about the mechanics of this. When would it have to be read to fulfill this role and what does “pre-set” really mean in light of that as far as precedence if there are duplicate entries? Wouldn’t everything that could be set have to be something that will also appear in CMakeCache.txt? I assume the format would be just like CMakeCache.txt? …which would be ideal. ** ** Thanks, Could you use an initial cache file - see the -C initial-cache command line option for CMake? Apologies if you've already seen that, but it seems to fit what you're looking for. The format of the initial cache is CMake script rather than CMakeCache.txt, but as it's just set(...) commands with the CACHE option it should be easy for users to write. I'm not 100% sure what you need in terms of persistency and precedence, but variables set in an initial cache file will take priority over the project's default values according to the CMake manaul entry. Cheers, Ben. -- 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] Can imported libraries depend on ExternalProject targets?
Say I have an ExternalProject that generates several libraries ExternalProject_Add(foo # the usual mumbo jumbo ) set(foo_LIBRARIES) # foo makes 3 libraries foreach(lib a b c) # import the libraries add_library(${lib} STATIC IMPORTED) # tell CMake where the library file is set_property(TARGET ${lib} PROPERTY IMPORTED_LOCATION ${imported_library_filename}) # add to the library list list(APPEND foo_LIBRARIES ${lib}) # this doesn't work apparently add_dependencies(${lib} foo) endforeach() In order for parallel make to work, the foo ExternalProject must complete successfully before any programs that link to ${foo_LIBRARIES} are compiled and linked. I thought that making the imported library targets depend on the ExternalProject target would behave in a transitive manner - i.e. add_executable(foo_user foo.cxx) target_link_libraries(foo_user ${foo_LIBRARIES}) But this is not the case. In a parallel build, the foo_user build doesn't wait for the foo ExternalProject to finish. If I add add_dependencies(foo_user foo) Everything behaves fine. But that requires explicitly add a dependency on an ExternalProject target everywhere it's outputs are used. Is this a bug? A feature request? Or is there another way to make this work? -- 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] make a project also a subproject
Suppose I have two projects, A and B. A builds a shared lib that links with a static lib in B. Sometimes, I want to build and test B by itself. Other times I want to build A, which requires building B. For now, I manually (or with a script) build B, then set an environment variable to say where the built static lib is, and then build A (which uses the environment variable). This is...not superb. If I wrote A's CMakeLists.txt to have add_subdirectory(B), it would error when it hit B's project(B). It probably would work (with some tweaking) if I removed project(B), but then I couldn't build B by itself. Is there a right way to do this? Is there a good, reliable way to detect that project(A) has already been called, and then (if that's the case) skip project(B)? Will that work? -- Cheers, Leif -- 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] make a project also a subproject
Hi Leif. I'm not on a machine with cmake now so I can't test, but I guess the variable PROJECT_NAME is empty if no project() has been called yet. Petr On Fri, Jun 22, 2012 at 6:10 PM, Leif Walsh leif.wa...@gmail.com wrote: Suppose I have two projects, A and B. A builds a shared lib that links with a static lib in B. Sometimes, I want to build and test B by itself. Other times I want to build A, which requires building B. For now, I manually (or with a script) build B, then set an environment variable to say where the built static lib is, and then build A (which uses the environment variable). This is...not superb. If I wrote A's CMakeLists.txt to have add_subdirectory(B), it would error when it hit B's project(B). It probably would work (with some tweaking) if I removed project(B), but then I couldn't build B by itself. Is there a right way to do this? Is there a good, reliable way to detect that project(A) has already been called, and then (if that's the case) skip project(B)? Will that work? -- Cheers, Leif -- 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] make a project also a subproject
Hi, On Fri, Jun 22, 2012 at 6:10 PM, Leif Walsh leif.wa...@gmail.com wrote: Suppose I have two projects, A and B. A builds a shared lib that links with a static lib in B. Sometimes, I want to build and test B by itself. Other times I want to build A, which requires building B. For now, I manually (or with a script) build B, then set an environment variable to say where the built static lib is, and then build A (which uses the environment variable). This is...not superb. If I wrote A's CMakeLists.txt to have add_subdirectory(B), it would error when it hit B's project(B). What makes you think that having 2 project() invocations in the same cmake source tree causes a problem for cmake? Or maybe this was a problem in some older versions of cmake, my 2.8.8 here groks a sample with 2 project() calls in a setup as you describe just fine. Andreas -- 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] Can imported libraries depend on ExternalProject targets?
On Fri, Jun 22, 2012 at 11:33 AM, Kent Williams nkwmailingli...@gmail.comwrote: Say I have an ExternalProject that generates several libraries ExternalProject_Add(foo # the usual mumbo jumbo ) set(foo_LIBRARIES) # foo makes 3 libraries foreach(lib a b c) # import the libraries add_library(${lib} STATIC IMPORTED) # tell CMake where the library file is set_property(TARGET ${lib} PROPERTY IMPORTED_LOCATION ${imported_library_filename}) # add to the library list list(APPEND foo_LIBRARIES ${lib}) # this doesn't work apparently add_dependencies(${lib} foo) endforeach() In order for parallel make to work, the foo ExternalProject must complete successfully before any programs that link to ${foo_LIBRARIES} are compiled and linked. I thought that making the imported library targets depend on the ExternalProject target would behave in a transitive manner - i.e. add_executable(foo_user foo.cxx) target_link_libraries(foo_user ${foo_LIBRARIES}) But this is not the case. In a parallel build, the foo_user build doesn't wait for the foo ExternalProject to finish. If I add add_dependencies(foo_user foo) Everything behaves fine. But that requires explicitly add a dependency on an ExternalProject target everywhere it's outputs are used. Is this a bug? A feature request? Or is there another way to make this work? It's neither a bug nor a feature request, it's just the way it works. The explicit dependency is the only way to connect up the outputs of one ExternalProject call to another, which by their nature are independent of one another unless explicitly connected via arguments / cache entries. If you want foo_user to depend on the actual libraries, then it should be its own project that does a find_package(foo) to get them. And then *also* have a SuperBuild that builds foo and then foo_user, where foo_user as an ExternalProject depends on foo as an ExternalProject. The best way to use ExternalProject is to have a SuperBuild project that builds *everything* as an ExternalProject. It's not easy (or advisable, in my thinking) to combine ExternalProject calls with non-ExternalProject CMake targets. That's why I recommend a SuperBuild, with exclusively ExternalProject targets, as the best bet. HTH, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] make a project also a subproject
On Fri, Jun 22, 2012 at 12:10 PM, Leif Walsh leif.wa...@gmail.com wrote: Suppose I have two projects, A and B. A builds a shared lib that links with a static lib in B. Sometimes, I want to build and test B by itself. Other times I want to build A, which requires building B. For now, I manually (or with a script) build B, then set an environment variable to say where the built static lib is, and then build A (which uses the environment variable). This is...not superb. If I wrote A's CMakeLists.txt to have add_subdirectory(B), it would error when it hit B's project(B). It probably would work (with some tweaking) if I removed project(B), but then I couldn't build B by itself. What is the error? This should work just fine. We have several project() commands in many projects (VTK, for example) and they are intended to work well that way. Each project() command maps to a generated *.sln file with the Visual Studio generators. It is recommended to have only one project command per-CMakeLists file, but even multiple calls are supported. Is there a right way to do this? Is there a good, reliable way to detect that project(A) has already been called, and then (if that's the case) skip project(B)? Will that work? -- Cheers, Leif -- 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] make a project also a subproject
That is very encouraging. I remembered getting problems but haven't tried on 2.8.8 yet I guess. Thanks, I'll try it soon. Sent from my iPhone On Jun 22, 2012, at 13:32, David Cole david.c...@kitware.com wrote: On Fri, Jun 22, 2012 at 12:10 PM, Leif Walsh leif.wa...@gmail.com wrote: Suppose I have two projects, A and B. A builds a shared lib that links with a static lib in B. Sometimes, I want to build and test B by itself. Other times I want to build A, which requires building B. For now, I manually (or with a script) build B, then set an environment variable to say where the built static lib is, and then build A (which uses the environment variable). This is...not superb. If I wrote A's CMakeLists.txt to have add_subdirectory(B), it would error when it hit B's project(B). It probably would work (with some tweaking) if I removed project(B), but then I couldn't build B by itself. What is the error? This should work just fine. We have several project() commands in many projects (VTK, for example) and they are intended to work well that way. Each project() command maps to a generated *.sln file with the Visual Studio generators. It is recommended to have only one project command per-CMakeLists file, but even multiple calls are supported. Is there a right way to do this? Is there a good, reliable way to detect that project(A) has already been called, and then (if that's the case) skip project(B)? Will that work? -- Cheers, Leif -- 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] Can imported libraries depend on ExternalProject targets?
OK, I guess. The only reason I bring this up is ITK. If you're familiar with the ITK build process, it has a 'module' concept -- not a module in the CMake sense (where it is a library intended for runtime loading), but in the sense that the build process is modular. Each of the ITK libraries is a module, which is defined by a standardised directory layout and cmake files. I made an Module for DCMTK that satisfies the requirements of an ITK module -- it builds DCMTK as an External Project, and uses add_library(name lib-type IMPORTED) on each of the libraries DCMTK creates, and connects the imported library with the actual library file in the file system. This all works fine EXCEPT for this one conundrum, you can't have the imported libraries depend on the ExternalProject target, so if you want to make sure the ExternalProject gets built before the targets that try to link to them, you have to make the executable (or library) target depend on the ExternalProject target to serialize the build of the dependee before the depnder. So really it would be easy to just say 'too bad, make ITK its own external project, and build the prerequisite' or 'too bad, add the 3rd party library source to ITK/Modules/ThirdParty the way we've always done it, but it would be kind of awesome if CMake could handle imported libraries depending on targets. If you're curious about what I've done: http://review.source.kitware.com/#/c/5989/ On Fri, Jun 22, 2012 at 12:29 PM, David Cole david.c...@kitware.com wrote: On Fri, Jun 22, 2012 at 11:33 AM, Kent Williams nkwmailingli...@gmail.com wrote: Say I have an ExternalProject that generates several libraries ExternalProject_Add(foo # the usual mumbo jumbo ) set(foo_LIBRARIES) # foo makes 3 libraries foreach(lib a b c) # import the libraries add_library(${lib} STATIC IMPORTED) # tell CMake where the library file is set_property(TARGET ${lib} PROPERTY IMPORTED_LOCATION ${imported_library_filename}) # add to the library list list(APPEND foo_LIBRARIES ${lib}) # this doesn't work apparently add_dependencies(${lib} foo) endforeach() In order for parallel make to work, the foo ExternalProject must complete successfully before any programs that link to ${foo_LIBRARIES} are compiled and linked. I thought that making the imported library targets depend on the ExternalProject target would behave in a transitive manner - i.e. add_executable(foo_user foo.cxx) target_link_libraries(foo_user ${foo_LIBRARIES}) But this is not the case. In a parallel build, the foo_user build doesn't wait for the foo ExternalProject to finish. If I add add_dependencies(foo_user foo) Everything behaves fine. But that requires explicitly add a dependency on an ExternalProject target everywhere it's outputs are used. Is this a bug? A feature request? Or is there another way to make this work? It's neither a bug nor a feature request, it's just the way it works. The explicit dependency is the only way to connect up the outputs of one ExternalProject call to another, which by their nature are independent of one another unless explicitly connected via arguments / cache entries. If you want foo_user to depend on the actual libraries, then it should be its own project that does a find_package(foo) to get them. And then *also* have a SuperBuild that builds foo and then foo_user, where foo_user as an ExternalProject depends on foo as an ExternalProject. The best way to use ExternalProject is to have a SuperBuild project that builds *everything* as an ExternalProject. It's not easy (or advisable, in my thinking) to combine ExternalProject calls with non-ExternalProject CMake targets. That's why I recommend a SuperBuild, with exclusively ExternalProject targets, as the best bet. HTH, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Return code from CMake script
If CMake is running a script via -P, doesn't it return a non-zero status if there's any error? I'd think it would be sufficient to run to the end of the script if everything works fine, but have something like if(something_went_wrong) message(FATAL_ERROR ¡OH NO! ¡SUCEDIO ALGO TERRIBLE!!!) endif(something_went_wrong) On Fri, Jun 22, 2012 at 9:35 AM, Pere Mato Vila pere.m...@cern.ch wrote: On Jun 22, 2012, at 4:25 PM, David Cole wrote: As an alternative (workaround), perhaps you could write the status value into a file that you inspect after CMake returns? Unfortunately this is not possible because who calls by script is ctest. Then it should definitely be possible. I meant ctest as the one that calls the test I have declared with add_test(). What I have is something like this: add_test(cmake -D... -P myscript.cmake) Cheers, Pere - Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland e-mail: pere.m...@cern.ch tel: +41 22 76 78696 fax: +41 22 76 68792 gsm: +41 76 48 70855 -- 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] Text user configuration (features, flags) that is more persistent than cache?
Ben, Thanks. I saw -C but misunderstood it. It does fit well. For user acceptance, the cache sytax would be preferable, but you can't have everything and I'm not about to set it up as an elaborate workaround. The include solution I quoted obviously assumed regular cmake syntax as well. Thanks again. Eli From: cmake-boun...@cmake.org [cmake-boun...@cmake.org] On Behalf Of Ben Morgan [bmorgan.warw...@gmail.com] Sent: Friday, June 22, 2012 8:32 AM To: cmake@cmake.org Subject: Re: [CMake] Text user configuration (features, flags) that is more persistent than cache? Hi Eli, On 21 June 2012 21:25, Ateljevich, Eli e...@water.ca.govmailto:e...@water.ca.gov wrote: Hi, I was wondering if there is a best practice for providing a file for user configuration decisions (options, unique flags) that will be more persistent than the cache? I have a project where a dozen or two algorithmic decisions have to be made. I find that this is just enough that cache overwrites cause me fear. I could do this on the environment, I suppose, but most of my users prefer a small list of name-value pairs for decisions that are pretty stable for them. I couldn’t find anything on this. The concept is alluded to by a 2001 email about INCLUDE by Bill Hoffman: It could be used like this: INCLUDE (${PROJECT_BINARY_DIR}/UserCacheSettings.txt OPTIONAL) This would allow the user to pre-set values for the Cache file, but still be able to delete the Cache file. But I wasn’t sure about the mechanics of this. When would it have to be read to fulfill this role and what does “pre-set” really mean in light of that as far as precedence if there are duplicate entries? Wouldn’t everything that could be set have to be something that will also appear in CMakeCache.txt? I assume the format would be just like CMakeCache.txt? …which would be ideal. Thanks, Could you use an initial cache file - see the -C initial-cache command line option for CMake? Apologies if you've already seen that, but it seems to fit what you're looking for. The format of the initial cache is CMake script rather than CMakeCache.txt, but as it's just set(...) commands with the CACHE option it should be easy for users to write. I'm not 100% sure what you need in terms of persistency and precedence, but variables set in an initial cache file will take priority over the project's default values according to the CMake manaul entry. Cheers, Ben. -- 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 convince cmake to find Tcl/Tk 8.6?
Hi all, I am using cmake 2.8.8 under Fedora 17 64 bit, in which I have installed ActiveTcl 8.6 in /opt. My path variable starts with: /opt/ActiveTcl-8.6/bin:... And when I run tclsh/tclsh8.6/wish/wish8.6, I get the ActiveTcl one, from /opt. However, cmake does not find this Tcl/Tk installation, and locates instead Tcl 8.5 installed in /usr. (Which cannot be used for compilation, since the application depends on 8.6 features). How can I convince cmake to pick up the 8.6 version installed in /opt/ActiveTcl-8.6/ ? George -- 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 convince cmake to find Tcl/Tk 8.6?
Have you tried setting CMAKE_PREFIX_PATH to /opt/ActiveTcl-8.6? On Fri, Jun 22, 2012 at 3:43 PM, Georgios Petasis petas...@yahoo.gr wrote: Hi all, I am using cmake 2.8.8 under Fedora 17 64 bit, in which I have installed ActiveTcl 8.6 in /opt. My path variable starts with: /opt/ActiveTcl-8.6/bin:... And when I run tclsh/tclsh8.6/wish/wish8.6, I get the ActiveTcl one, from /opt. However, cmake does not find this Tcl/Tk installation, and locates instead Tcl 8.5 installed in /usr. (Which cannot be used for compilation, since the application depends on 8.6 features). How can I convince cmake to pick up the 8.6 version installed in /opt/ActiveTcl-8.6/ ? George -- 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] local and system installs that include python and shell scripts
Hi again, My project is set up so that the compiled targets naturally get output to a structure that looks like a development mode installation: /myproj /build /bin /lib /include This is convenient for some users ... it is the sort of code people tinker with, and I think a lot of my users will actually want to keep it local. I will offer a more typical install as well. In addition, I have some python and shell scripts mixed in with my source code in subdirectories. These don't naturally get moved anywhere during the build and I would like to do so to complete the development installation idea: /myproj /build /bin /lib /include /scripts something.sh /pylib scripts and python shared libraries How is this best done? Should I treat this as a case of install? In that case when development mode is on I would install to the local directory. Strangely, for 90% of the project the source and destination will be the same - which is what makes it seem weird. Or should I just use command with cmake -E style copying locally and only use install for the system install? It may be that either will work, but it seems from my last post or two that I don't always see the usual idioms and it could be neither of my guesses is a good one. Thanks, Eli -- 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 convince cmake to find Tcl/Tk 8.6?
No, I didn't know about this option. I tried it, and it does work. Thank you, George Απο: David Cole david.c...@kitware.com Προς: petas...@yahoo.gr Κοιν.: cmake cmake@cmake.org Στάλθηκε: 10:52 μ.μ. Παρασκευή, 22 Ιουνίου 2012 Θεμα: Re: [CMake] How to convince cmake to find Tcl/Tk 8.6? Have you tried setting CMAKE_PREFIX_PATH to /opt/ActiveTcl-8.6? On Fri, Jun 22, 2012 at 3:43 PM, Georgios Petasis petas...@yahoo.gr wrote: Hi all, I am using cmake 2.8.8 under Fedora 17 64 bit, in which I have installed ActiveTcl 8.6 in /opt. My path variable starts with: /opt/ActiveTcl-8.6/bin:... And when I run tclsh/tclsh8.6/wish/wish8.6, I get the ActiveTcl one, from /opt. However, cmake does not find this Tcl/Tk installation, and locates instead Tcl 8.5 installed in /usr. (Which cannot be used for compilation, since the application depends on 8.6 features). How can I convince cmake to pick up the 8.6 version installed in /opt/ActiveTcl-8.6/ ? George -- 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] (no subject)
I had this warning under Fedora 17, 64 bit: -- Searching for Java... CMake Warning at /usr/share/cmake/Modules/FindJava.cmake:120 (message): regex not supported: java version 1.7.0_03-icedtea OpenJDK Runtime Environment (fedora-2.2.1.fc17.8-x86_64) OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode). Please report Call Stack (most recent call first): CMakeLists.txt:139 (FIND_PACKAGE) George-- 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] Finding Mali Developer Tools OpenGL ES 2.0 emulator under windows
I'm trying to build a find module to seek out the EGL library provided as part of the Mali Developer Tool suite under win32. The file I want is at C:/Program Files (x86)/ARM/Mali Developer Tools/OpenGL ES Emulator v1.3.0 I cant for the life of me get it to succeed in finding the path. Am I doing something wrong with handling the spaces? # - Try to find EGL # Once done this will define # EGL_FOUND - System has GLES # EGL_INCLUDE_DIRS - The GLES include directories # EGL_LIBRARIES - The libraries needed to use GLES SET(EGL_FOUND FALSE) SET(MALI_DIR C:/Program Files (x86)/ARM/Mali Developer Tools/OpenGL ES Emulator v1.3.0) find_path(EGL_INCLUDE_DIR egl.h PATHS ${MALI_DIR}/include NO_DEFAULT_PATH ) find_library(EGL_LIBRARY NAMES EGL PATHS ${MALI_DIR}\bin) set(EGL_LIBRARIES ${EGL_LIBRARY} ) set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR} ) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set EGL_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR) IF(EGL_LIBRARY AND EGL_INCLUDE_DIR) SET(EGL_FOUND TRUE) ENDIF() -- Jonathan S. Romero -- 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.8-3311-g31b9aaf
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 31b9aaf60da6eee0610b4a0347e58cbf7e68077e (commit) via 3a17311bc89053f9f71f4a50e95efd1f7f313ef7 (commit) via 03022877399735b930ae44f1fd2d19d64e4a8a2f (commit) from 6d52cb8f6ad489c777db89edb9b517521bb1f6cb (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=31b9aaf60da6eee0610b4a0347e58cbf7e68077e commit 31b9aaf60da6eee0610b4a0347e58cbf7e68077e Merge: 6d52cb8 3a17311 Author: David Cole david.c...@kitware.com AuthorDate: Fri Jun 22 11:23:20 2012 -0400 Commit: CMake Topic Stage kwro...@kitware.com CommitDate: Fri Jun 22 11:23:20 2012 -0400 Merge topic 'exclude-ExternalProject-test-for-cygwin-release-script' into next 3a17311 Release: Temporarily exclude ExternalProject test on cygwin 0302287 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a17311bc89053f9f71f4a50e95efd1f7f313ef7 commit 3a17311bc89053f9f71f4a50e95efd1f7f313ef7 Author: David Cole david.c...@kitware.com AuthorDate: Fri Jun 22 11:20:03 2012 -0400 Commit: David Cole david.c...@kitware.com CommitDate: Fri Jun 22 11:20:03 2012 -0400 Release: Temporarily exclude ExternalProject test on cygwin Only temporarily until we can setup a new cygwin build machine for making releases. It's specific to the script that runs on dash2win64 anyhow. When we add a new script to run it on a different machine, and stop building the cygwin releases on dash2win64, this change will naturally no longer apply. diff --git a/Utilities/Release/dash2win64_cygwin.cmake b/Utilities/Release/dash2win64_cygwin.cmake index 78e8df0..663c615 100644 --- a/Utilities/Release/dash2win64_cygwin.cmake +++ b/Utilities/Release/dash2win64_cygwin.cmake @@ -16,4 +16,12 @@ set(CC gcc) set(SCRIPT_NAME dash2win64cygwin) set(GIT_EXTRA git config core.autocrlf true) get_filename_component(path ${CMAKE_CURRENT_LIST_FILE} PATH) + +# WARNING: Temporary fix!! This exclusion of the ExternalProject test +# is temporary until we can set up a new cygwin build machine. +# It only fails because of cygwin/non-cygwin svn mismatches in this +# particular environment. This is less than ideal, but at least it +# allows us to produce cygwin builds in the short term. +set(EXTRA_CTEST_ARGS -E ExternalProject) + include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in index 50882c5..b5ff6dd 100755 --- a/Utilities/Release/release_cmake.sh.in +++ b/Utilities/Release/release_cmake.sh.in @@ -121,7 +121,7 @@ check_exit_value $? Build cmake || exit 1 if [ -z @SKIP_TESTS@ ]; then echo Run cmake tests -./bin/ctest --output-on-failure -j @PROCESSORS@ test +./bin/ctest --output-on-failure -j @PROCESSORS@ @EXTRA_CTEST_ARGS@ check_exit_value $? Test cmake || exit 1 fi --- Summary of changes: Source/CMakeVersion.cmake |2 +- Utilities/Release/dash2win64_cygwin.cmake |8 Utilities/Release/release_cmake.sh.in |2 +- 3 files changed, 10 insertions(+), 2 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.8-3313-g51a0558
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 51a05582f842f0b436381017219395ee899dedd9 (commit) via 214589b1f068800721c582b6983d718d5a66c04b (commit) from 31b9aaf60da6eee0610b4a0347e58cbf7e68077e (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=51a05582f842f0b436381017219395ee899dedd9 commit 51a05582f842f0b436381017219395ee899dedd9 Merge: 31b9aaf 214589b Author: David Cole david.c...@kitware.com AuthorDate: Fri Jun 22 14:34:03 2012 -0400 Commit: CMake Topic Stage kwro...@kitware.com CommitDate: Fri Jun 22 14:34:03 2012 -0400 Merge topic 'release-script-fixes' into next 214589b Add ability to run as a ctest -S script also http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=214589b1f068800721c582b6983d718d5a66c04b commit 214589b1f068800721c582b6983d718d5a66c04b Author: David Cole david.c...@kitware.com AuthorDate: Fri Jun 22 14:32:29 2012 -0400 Commit: David Cole david.c...@kitware.com CommitDate: Fri Jun 22 14:32:29 2012 -0400 Add ability to run as a ctest -S script also Then, use ctest_sleep to separate uploads by at least one second each, so that the files on the web server all get distinct time stamps. Then, when viewed on the web server, sorted by time, they are also sorted alphabetically. diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index dc6c78f..bd79296 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,4 +1,7 @@ -set(PROJECT_PREFIX cmake-) +set(CTEST_RUN_CURRENT_SCRIPT 0) +if(NOT DEFINED PROJECT_PREFIX) + set(PROJECT_PREFIX cmake-) +endif() if(NOT VERSION) set(VERSION 2.8) endif() @@ -18,11 +21,18 @@ foreach(file ${FILES}) message(upload ${file} ${UPLOAD_LOC}) execute_process(COMMAND scp ${file} ${UPLOAD_LOC} - RESULT_VARIABLE result) -math(EXPR count ${count} + 1) + RESULT_VARIABLE result) if(${result} GREATER 0) message(FATAL_ERROR failed to upload file to ${UPLOAD_LOC}) endif() + +# Pause to give each upload a distinct (to the nearest second) +# time stamp +if(COMMAND ctest_sleep) + ctest_sleep(2) +endif() + +math(EXPR count ${count} + 1) endif() endforeach(file) if(${count} EQUAL 0) --- Summary of changes: Utilities/Release/upload_release.cmake | 16 +--- 1 files changed, 13 insertions(+), 3 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, master, updated. v2.8.8-413-g72ce588
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 72ce5889338af7e7c121be0941a2aceecaf7f3ca (commit) from 03022877399735b930ae44f1fd2d19d64e4a8a2f (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=72ce5889338af7e7c121be0941a2aceecaf7f3ca commit 72ce5889338af7e7c121be0941a2aceecaf7f3ca Author: Kitware Robot kwro...@kitware.com AuthorDate: Sat Jun 23 00:01:04 2012 -0400 Commit: Kitware Robot kwro...@kitware.com CommitDate: Sat Jun 23 00:01:04 2012 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fecea12..2c69b95 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_PATCH 8) -SET(CMake_VERSION_TWEAK 20120622) +SET(CMake_VERSION_TWEAK 20120623) #SET(CMake_VERSION_RC 1) --- Summary of changes: Source/CMakeVersion.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