Re: [CMake] Correct usage of add_library
Hello, thank you very much, it works fine! Do you know how to create a target so that make mykernel creates a library libkernel.so? For the moment, I create a library with the command add_library(kernel SHARED ${src}) and I build libkernel.so by typing make. I have found there exists a command add_custom_target but I don't know how to use it. I tried add_custom_target(mykernel DEPENDS kernel) but it does not seems to take my include_directories instructions into account since some headers are not found anymore (they're found when I type 'make'). Cédric - Mail original - > De: "Sergei Nikulov"> À: "Cedric Doucet" > Cc: cmake@cmake.org > Envoyé: Mercredi 23 Décembre 2015 11:38:38 > Objet: Re: [CMake] Correct usage of add_library > > Hello, > > 2015-12-23 13:32 GMT+03:00 Cedric Doucet : > > > > Hello, > > > > I have a code which consist in a kernel and several independent modules > > which depend on this kernel. > > I would like to let users build the module they want by typing, for > > example, > > > > make module1 > > > > to build the first module. > > But, as this first module depends on the kernel, I need this kernel to be > > built BEFORE module1. > > > > You should add > > add_dependencies(module1 kernel) > > in your module1 CMakeLists.txt > > https://cmake.org/cmake/help/latest/command/add_dependencies.html > > HTH, > > -- > Best Regards, > Sergei Nikulov > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Correct usage of add_library
Sorry, it was a mistake! Everything works fine! Best, Cédric - Mail original - > De: "Cedric Doucet"> À: "Sergei Nikulov" > Cc: cmake@cmake.org > Envoyé: Mercredi 23 Décembre 2015 12:59:48 > Objet: Re: [CMake] Correct usage of add_library > > > Hello, > > thank you very much, it works fine! > > Do you know how to create a target so that > >make mykernel > > creates a library libkernel.so? > > > For the moment, I create a library with the command > >add_library(kernel SHARED ${src}) > > and I build libkernel.so by typing make. > > I have found there exists a command add_custom_target but I don't know how to > use it. > I tried > >add_custom_target(mykernel DEPENDS kernel) > > but it does not seems to take my include_directories instructions into > account since some headers are not found anymore (they're found when I type > 'make'). > > Cédric > > - Mail original - > > De: "Sergei Nikulov" > > À: "Cedric Doucet" > > Cc: cmake@cmake.org > > Envoyé: Mercredi 23 Décembre 2015 11:38:38 > > Objet: Re: [CMake] Correct usage of add_library > > > > Hello, > > > > 2015-12-23 13:32 GMT+03:00 Cedric Doucet : > > > > > > Hello, > > > > > > I have a code which consist in a kernel and several independent modules > > > which depend on this kernel. > > > I would like to let users build the module they want by typing, for > > > example, > > > > > > make module1 > > > > > > to build the first module. > > > But, as this first module depends on the kernel, I need this kernel to be > > > built BEFORE module1. > > > > > > > You should add > > > > add_dependencies(module1 kernel) > > > > in your module1 CMakeLists.txt > > > > https://cmake.org/cmake/help/latest/command/add_dependencies.html > > > > HTH, > > > > -- > > Best Regards, > > Sergei Nikulov > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Correct usage of add_library
2015-12-23 15:08 GMT+03:00 Cedric Doucet: > > Sorry, it was a mistake! > Everything works fine! > Nice to hear that. And another update to my previous answer. If your module depends on kernel library (as I understand now it should be linked to module) you'd better use target_link_libraries(module1 kernel) https://cmake.org/cmake/help/v3.4/command/target_link_libraries.html This dependency also should be resolved first and add kernel library to linker command. > > > > - Mail original - >> De: "Cedric Doucet" >> À: "Sergei Nikulov" >> Cc: cmake@cmake.org >> Envoyé: Mercredi 23 Décembre 2015 12:59:48 >> Objet: Re: [CMake] Correct usage of add_library >> >> >> Hello, >> >> thank you very much, it works fine! >> >> Do you know how to create a target so that >> >>make mykernel >> >> creates a library libkernel.so? >> >> >> For the moment, I create a library with the command >> >>add_library(kernel SHARED ${src}) >> >> and I build libkernel.so by typing make. >> >> I have found there exists a command add_custom_target but I don't know how to >> use it. >> I tried >> >>add_custom_target(mykernel DEPENDS kernel) >> >> but it does not seems to take my include_directories instructions into >> account since some headers are not found anymore (they're found when I type >> 'make'). >> >> Cédric >> >> - Mail original - >> > De: "Sergei Nikulov" >> > À: "Cedric Doucet" >> > Cc: cmake@cmake.org >> > Envoyé: Mercredi 23 Décembre 2015 11:38:38 >> > Objet: Re: [CMake] Correct usage of add_library >> > >> > Hello, >> > >> > 2015-12-23 13:32 GMT+03:00 Cedric Doucet : >> > > >> > > Hello, >> > > >> > > I have a code which consist in a kernel and several independent modules >> > > which depend on this kernel. >> > > I would like to let users build the module they want by typing, for >> > > example, >> > > >> > > make module1 >> > > >> > > to build the first module. >> > > But, as this first module depends on the kernel, I need this kernel to be >> > > built BEFORE module1. >> > > >> > >> > You should add >> > >> > add_dependencies(module1 kernel) >> > >> > in your module1 CMakeLists.txt >> > >> > https://cmake.org/cmake/help/latest/command/add_dependencies.html >> > >> > HTH, >> > >> > -- >> > Best Regards, >> > Sergei Nikulov >> > >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake >> -- Best Regards, Sergei Nikulov -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] change add_executable to add_library leads to an error
Hi Cedric. add_custom_target() does not work the way you think it does. The arguments given after the target name are commands which the custom target will execute. So what your custom target `statphys` does is execute a program named `simol-statphys`. When `simol-statphys` was the name of an executable target, CMake figured out a dependency based on this and arranged it so that `simol-statphys` is built first and then executed. However, when `simol-statphys` is a library target, it does not receive this special treatment; and why would it, since you cannot execute a library. Therefore, it simply tries to execute a program named `simol-statphys` and, expectedly, fails. If I understand your intention with the custom target correctly, you want to have a shorthand alias for the target in the makefile. The correct syntax to achieve that would be: add_custom_target(statphys) add_dependencies(statphys simol-statphys) Hope this helps. Petr On Wed, Dec 23, 2015 at 2:26 PM, Cedric Doucetwrote: > > Hello, > > I have the following script: > = > > file(GLOB_RECURSE statphys "*.cpp") > > > #add_library(simol-statphys SHARED ${statphys}) > add_executable(simol-statphys ${statphys}) > > > add_dependencies(simol-statphys simol-core) > > add_custom_target(statphys simol-statphys) > > > target_link_libraries(simol-statphys simol-core) > > target_link_libraries(simol-statphys > ${ARMADILLO_INSTALL_DIR}/lib/libarmadillo.so) > target_link_libraries(simol-statphys > ${YAMLCPP_INSTALL_DIR}/lib/libyaml-cpp.a) > > = > > > I would like generate a shared library simol-statphys instead of an > executable simol-statphys. > > In other words, I would like to replace the call to add_executable, to the > one which is contained in the comment below this call. > > > However, if I do this, and I type > > > make statphys > > > I get the following error message: > > > Scanning dependencies of target statphys > /bin/sh: 1: simol-statphys: not found > make[3]: *** [src/modules/statphys/CMakeFiles/statphys] Erreur 127 > make[2]: *** [src/modules/statphys/CMakeFiles/statphys.dir/all] Erreur 2 > make[1]: *** [src/modules/statphys/CMakeFiles/statphys.dir/rule] Erreur 2 > make: *** [statphys] Erreur 2 > > > Does someone can explain me where do the problem come from? > > > Cédric > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[cmake-developers] [CMake 0015895]: bootstrap compilation error
The following issue has been SUBMITTED. == https://cmake.org/Bug/view.php?id=15895 == Reported By:Burlen Assigned To: == Project:CMake Issue ID: 15895 Category: CMake Reproducibility:always Severity: major Priority: normal Status: new == Date Submitted: 2015-12-23 10:50 EST Last Modified: 2015-12-23 10:50 EST == Summary:bootstrap compilation error Description: g++ -I/Users/bloring/apps/cmake/builds/cmake-3.4.1/Bootstrap.cmk -I/Users/bloring/apps/cmake/builds/cmake-3.4.1/Source -I/Users/bloring/apps/cmake/builds/cmake-3.4.1/Bootstrap.cmk -c /Users/bloring/apps/cmake/builds/cmake-3.4.1/Source/cmBootstrapCommands1.cxx -o cmBootstrapCommands1.o In file included from /usr/include/dispatch/dispatch.h:51:0, from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15, from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13, from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55, from /Users/bloring/apps/cmake/builds/cmake-3.4.1/Source/cmFindProgramCommand.cxx:16, from /Users/bloring/apps/cmake/builds/cmake-3.4.1/Source/cmBootstrapCommands1.cxx:52: /usr/include/dispatch/object.h:143:15: error: expected unqualified-id before ‘^’ token typedef void (^dispatch_block_t)(void); ^ /usr/include/dispatch/object.h:143:15: error: expected ‘)’ before ‘^’ token /usr/include/dispatch/object.h:362:3: error: ‘dispatch_block_t’ has not been declared dispatch_block_t notification_block); ^ make: *** [cmBootstrapCommands1.o] Error 1 - Error when bootstrapping CMake: Problem while running make - Steps to Reproduce: ./configure && make == Issue History Date ModifiedUsername FieldChange == 2015-12-23 10:50 Burlen New Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [CMake 0015894]: Visual C++ 2015 Generator wrong output for debug information
The following issue has been SUBMITTED. == https://public.kitware.com/Bug/view.php?id=15894 == Reported By:Thomas Laguzzi Assigned To: == Project:CMake Issue ID: 15894 Category: CMake Reproducibility:always Severity: major Priority: normal Status: new == Date Submitted: 2015-12-23 08:04 EST Last Modified: 2015-12-23 08:04 EST == Summary:Visual C++ 2015 Generator wrong output for debug information Description: In 2015 there are three options to generate debug informations: None, Debug , Debug with fastlink (/DEBUG and /DEBUG:FASTLINK) The tag in the .vcxproj file doesn't take true or false anymore, instead it takes 3 values No Debug DebugFastLink depending on the option choosen, else you will see a wrong property value in the property sheet Note: it's not sufficient to add /DEBUG:FASTLINK to the additional options, it is ignored unless the .vcxproject file is correct. Steps to Reproduce: Just generate any Visual C++ project using Visual C++ 2015 (update 1). Additional Information: Tryed with Update 1 both 32 and 64bit. Don't know if previous versions have the same issue. == Issue History Date ModifiedUsername FieldChange == 2015-12-23 08:04 Thomas Laguzzi New Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [CMake] Tests with assert and Release build type
On 22-Dec-15 04:07, Magnus Therning wrote: Ruslan Baratov writes: On 20-Dec-15 01:31, Magnus Therning wrote: Ruslan Baratov writes: How about using RelWithDebInfo? See: http://stackoverflow.com/a/28124715/2288008 Hmm, I'm probably missing something but how does that solve the issue with some targets requiring NDEBUG to be *undefined* and other targets requiring NDEBUG to be defined? I don't think that building targets with different NDEBUG values is a good idea. More correct approach will be to introduce custom macro to allow checks (i.e. FOO_NDEBUG/FOO_DEBUG). Why not? It is possible to hit situation when ODR will be violated, e.g. if somebody define optional member in structure with "#if defined(NDEBUG)" condition. Something like this: http://stackoverflow.com/questions/20833226/library-headers-and-define /M -- Magnus Therning OpenPGP: 0x927912051716CE39 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about. -- Albert Einstein -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] change add_executable to add_library leads to an error
Hello, I have the following script: = file(GLOB_RECURSE statphys "*.cpp") #add_library(simol-statphys SHARED ${statphys}) add_executable(simol-statphys ${statphys}) add_dependencies(simol-statphys simol-core) add_custom_target(statphys simol-statphys) target_link_libraries(simol-statphys simol-core) target_link_libraries(simol-statphys ${ARMADILLO_INSTALL_DIR}/lib/libarmadillo.so) target_link_libraries(simol-statphys ${YAMLCPP_INSTALL_DIR}/lib/libyaml-cpp.a) = I would like generate a shared library simol-statphys instead of an executable simol-statphys. In other words, I would like to replace the call to add_executable, to the one which is contained in the comment below this call. However, if I do this, and I type make statphys I get the following error message: Scanning dependencies of target statphys /bin/sh: 1: simol-statphys: not found make[3]: *** [src/modules/statphys/CMakeFiles/statphys] Erreur 127 make[2]: *** [src/modules/statphys/CMakeFiles/statphys.dir/all] Erreur 2 make[1]: *** [src/modules/statphys/CMakeFiles/statphys.dir/rule] Erreur 2 make: *** [statphys] Erreur 2 Does someone can explain me where do the problem come from? Cédric -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] change add_executable to add_library leads to an error
Hi Petr! Yes, it helps me a lot! I have tried to apply your approach and this is exactly what I want. Thank you! :) Cédric - Mail original - > De: "Petr Kmoch"> À: "Cedric Doucet" > Cc: cmake@cmake.org > Envoyé: Mercredi 23 Décembre 2015 14:41:55 > Objet: Re: [CMake] change add_executable to add_library leads to an error > Hi Cedric. > add_custom_target() does not work the way you think it does. The arguments > given after the target name are commands which the custom target will > execute. So what your custom target `statphys` does is execute a program > named `simol-statphys`. When `simol-statphys` was the name of an executable > target, CMake figured out a dependency based on this and arranged it so that > `simol-statphys` is built first and then executed. > However, when `simol-statphys` is a library target, it does not receive this > special treatment; and why would it, since you cannot execute a library. > Therefore, it simply tries to execute a program named `simol-statphys` and, > expectedly, fails. > If I understand your intention with the custom target correctly, you want to > have a shorthand alias for the target in the makefile. The correct syntax to > achieve that would be: > add_custom_target(statphys) > add_dependencies(statphys simol-statphys) > Hope this helps. > Petr > On Wed, Dec 23, 2015 at 2:26 PM, Cedric Doucet < cedric.dou...@inria.fr > > wrote: > > Hello, > > > I have the following script: > > > = > > > file(GLOB_RECURSE statphys "*.cpp") > > > #add_library(simol-statphys SHARED ${statphys}) > > > add_executable(simol-statphys ${statphys}) > > > add_dependencies(simol-statphys simol-core) > > > add_custom_target(statphys simol-statphys) > > > target_link_libraries(simol-statphys simol-core) > > > target_link_libraries(simol-statphys > > ${ARMADILLO_INSTALL_DIR}/lib/libarmadillo.so) > > > target_link_libraries(simol-statphys > > ${YAMLCPP_INSTALL_DIR}/lib/libyaml-cpp.a) > > > = > > > I would like generate a shared library simol-statphys instead of an > > executable simol-statphys. > > > In other words, I would like to replace the call to add_executable, to the > > one which is contained in the comment below this call. > > > However, if I do this, and I type > > > make statphys > > > I get the following error message: > > > Scanning dependencies of target statphys > > > /bin/sh: 1: simol-statphys: not found > > > make[3]: *** [src/modules/statphys/CMakeFiles/statphys] Erreur 127 > > > make[2]: *** [src/modules/statphys/CMakeFiles/statphys.dir/all] Erreur 2 > > > make[1]: *** [src/modules/statphys/CMakeFiles/statphys.dir/rule] Erreur 2 > > > make: *** [statphys] Erreur 2 > > > Does someone can explain me where do the problem come from? > > > Cédric > > > -- > > > Powered by www.kitware.com > > > Please keep messages on-topic and check the CMake FAQ at: > > http://www.cmake.org/Wiki/CMake_FAQ > > > Kitware offers various services to support the CMake community. For more > > information on each offering, please visit: > > > CMake Support: http://cmake.org/cmake/help/support.html > > > CMake Consulting: http://cmake.org/cmake/help/consulting.html > > > CMake Training Courses: http://cmake.org/cmake/help/training.html > > > Visit other Kitware open-source projects at > > http://www.kitware.com/opensource/opensource.html > > > Follow this link to subscribe/unsubscribe: > > > http://public.kitware.com/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Tests with assert and Release build type
Not only is it possible ... it WILL happen if you use the Microsoft C++ compiler and try to mix and match Release and Debug compilation units. The MS compiler has some very nice memory tracking facilities built into the Debug runtime libraries, but it is accomplished via different structs for Debug and Release builds with extra stuff in the Debug structs. So allocations from a Debug compilation unit will not be accessed correctly in a linked-in Release compilation unit when a pointer to it is passed across the boundary. You will see access violations and hard crashes happening in builds from the Microsoft compiler unless you ensure that everything in a build has matching Debug/Release defines and compiler settings. It is only safe to mix-n-match if all calls which cross a boundary between compilation units have NO differences in their struct and class definitions from an ABI perspective. Since it is difficult to verify when this is the case (in general) for large C++ projects, it's best to avoid mixing and matching... HTH, David C. On Wed, Dec 23, 2015 at 8:29 AM, Ruslan Baratov via CMakewrote: > On 22-Dec-15 04:07, Magnus Therning wrote: >> >> Ruslan Baratov writes: >> >>> On 20-Dec-15 01:31, Magnus Therning wrote: Ruslan Baratov writes: > How about using RelWithDebInfo? See: > http://stackoverflow.com/a/28124715/2288008 Hmm, I'm probably missing something but how does that solve the issue with some targets requiring NDEBUG to be *undefined* and other targets requiring NDEBUG to be defined? >>> >>> I don't think that building targets with different NDEBUG values is a >>> good idea. More correct approach will be to introduce custom macro to >>> allow checks (i.e. FOO_NDEBUG/FOO_DEBUG). >> >> Why not? > > It is possible to hit situation when ODR will be violated, e.g. if somebody > define optional member in structure with "#if defined(NDEBUG)" condition. > Something like this: > http://stackoverflow.com/questions/20833226/library-headers-and-define > >> >> /M >> >> -- >> Magnus Therning OpenPGP: 0x927912051716CE39 >> email: mag...@therning.org jabber: mag...@therning.org >> twitter: magthe http://therning.org/magnus >> >> We act as though comfort and luxury were the chief requirements of >> life, when all that we need to make us happy is something to be >> enthusiastic about. >> -- Albert Einstein > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] PythonInterp and PythonLibs find different versions on Apple
Hi, I'm having this issue that cmake using version 3.3.0. Python detection is finding different versions of interpreter and libraries. There are two version of Python installed, system one and homebrew one. cmake finds Interpreter from homebrew while libs are from system install. Here's my CmakeLists find_package(PythonInterp) find_package(PythonLibs) and configure output -- Found PythonInterp: /usr/local/bin/python (found version "2.7.11") -- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.10") I also tried find_package(PythonInterp) find_package(PythonLibs ${PYTHON_VERSION_STRING}) but got -- Found PythonInterp: /usr/local/bin/python (found version "2.7.11") -- Could NOT find PythonLibs: Found unsuitable version "2.7.10", but required is at least "2.7.11" (found /usr/lib/libpython2.7.dylib) I suppose I can just over ride these manually, but shouldn't this just work? or am I doing it wrong? Burlen ps. I tried to install cmake 3.4 on my system but bootstrap has a compile error. I observed the same with cmake 3.4.1 on a colleagues Apple system that has system Python plus Annaconda Python. This leads me to think that it's not addressed in 3.4.1. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] still having rpath problems on osx
> On Dec 23, 2015, at 12:02 PM, Boudewijn Remptwrote: > > On Tue, 22 Dec 2015, clin...@elemtech.com wrote: > >> >> On Dec 21, 2015 12:26 PM, Boudewijn Rempt wrote: >>> >>> All libraries I link to are built. Some come with a cmake build system, >>> some with an automake build system, boost with something else altogether... >>> But I wouldn't have expected the way a library is built to make a >>> difference for the link lines in the library that links to the other >>> library. >> >> You may not expect this, but this is how it works. @rpath is a way for a >> library to say, "i want to be found using rpaths" >> > > Hm... Okay -- so, since I all my dependencies myself as cmake external > projects, I guess I want all of them set to rpath. I guess that for boost, > with its own build system, I'll need to add a separate fix-up step to my > cmake externals project for boost. I have to check how I can fix the > dependencies that are still automake/autoconf based. And I'll try what you > suggest below for my own project. I have written scripts to do things like that for boost and ITK where the libraries do not have anything like @rpath or the absolute path to the installed library. After installing I run those scripts to “fix” the libraries so when I debug I can just run the application. During packaging I then run CMake’s BundleUtilities to copy in the libraries and adjust the libraries to have @rpath or @executable_path. When fixing up a library make sure you also fix all the dependent libraries that might be there. For things like Boost or ITK their higher level libraries depend on their lower level libraries. Using “otool -L” you can see this. Make sure you update EVERY path in the library. Also using MacDeployQt will NOT fix up any NON-Qt libraries (like Boost, HDF5.. ) so you will still need to run/write something that fixes all of those libraries. For our project we wrote a pure CMake script that does everything we need to fix up our bundles so that everything is self contained. — Mike Jackson > >> I think you are trying to hard to fix the problem in your cmake, by setting >> too many variables. The libraries you link against need fixed to behave how >> you want. >> >> By setting >> set(CMAKE_MACOSX_RPATH ON) you are setting @rpath for the install name of >> any library you build. >> >> By setting INSTALL_RPATH, you are indicating directories to substitute >> @rpath at runtime. >> >> >>> >>> * And for the library itself, I explicitly set: >>> if (APPLE) set_target_properties(kritaimage PROPERTIES INSTALL_RPATH >>> "@loader_path/../../../../lib;@loader_path/../lib;@loader_path/../Frameworks;@executable_path/../lib;@executable_path/../Frameworks") >>> endif() >>> Though I sort of feel that it shouldn't be necessary to explicitly set an >>> rpath to something I build. >> >> >> If you are going to install the library, you should set INSTALL_RPATH. >> > > Well, the way I set it up, which may be wrong of course, I install all the > dependecies to ~/dev/i, then build the main application that uses those > dependencies. When developing, I run the app bundle directly, linked to the > dependencies in ~/dev/i/lib; when distributing, I use macdeployqt to populate > the app bundle with all the dependencies and data. > > >> >> It is partly right. However, you may find it simpler to change the id of >> libraries before you link against them. >> For example >> install_name_tool -id @rpath/libboost_system.dylib libboost_system.dylib >> >> And use "install_name_tool -change" for any libraries that link against the >> library with the changed id, but only if you change the id after linking. >> > > Thanks! I think I'm finally beginning to grasp the idea :-) > > > -- > Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org-- > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] cmake 3.4.1 bootstrap compile error
I tried to download and compile 3.4.1 on Apple 10.10.5. I did ./configure prefix=blah && make here is the error: g++ -I/Users/bloring/apps/cmake/builds/cmake-3.4.1/Bootstrap.cmk -I/Users/bloring/apps/cmake/builds/cmake-3.4.1/Source -I/Users/bloring/apps/cmake/builds/cmake-3.4.1/Bootstrap.cmk -c /Users/bloring/apps/cmake/builds/cmake-3.4.1/Source/cmBootstrapCommands1.cxx -o cmBootstrapCommands1.o In file included from /usr/include/dispatch/dispatch.h:51:0, from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15, from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13, from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55, from /Users/bloring/apps/cmake/builds/cmake-3.4.1/Source/cmFindProgramCommand.cxx:16, from /Users/bloring/apps/cmake/builds/cmake-3.4.1/Source/cmBootstrapCommands1.cxx:52: /usr/include/dispatch/object.h:143:15: error: expected unqualified-id before ‘^’ token typedef void (^dispatch_block_t)(void); ^ /usr/include/dispatch/object.h:143:15: error: expected ‘)’ before ‘^’ token /usr/include/dispatch/object.h:362:3: error: ‘dispatch_block_t’ has not been declared dispatch_block_t notification_block); ^ make: *** [cmBootstrapCommands1.o] Error 1 I guess that this is because homebrew installed gcc. All the same, shouldn't this just work? If Cmake can't work with homebrew gcc then should it ignore it? Burlen -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] still having rpath problems on osx
On Tue, 22 Dec 2015, clin...@elemtech.com wrote: On Dec 21, 2015 12:26 PM, Boudewijn Remptwrote: All libraries I link to are built. Some come with a cmake build system, some with an automake build system, boost with something else altogether... But I wouldn't have expected the way a library is built to make a difference for the link lines in the library that links to the other library. You may not expect this, but this is how it works. @rpath is a way for a library to say, "i want to be found using rpaths" Hm... Okay -- so, since I all my dependencies myself as cmake external projects, I guess I want all of them set to rpath. I guess that for boost, with its own build system, I'll need to add a separate fix-up step to my cmake externals project for boost. I have to check how I can fix the dependencies that are still automake/autoconf based. And I'll try what you suggest below for my own project. I think you are trying to hard to fix the problem in your cmake, by setting too many variables. The libraries you link against need fixed to behave how you want. By setting set(CMAKE_MACOSX_RPATH ON) you are setting @rpath for the install name of any library you build. By setting INSTALL_RPATH, you are indicating directories to substitute @rpath at runtime. * And for the library itself, I explicitly set: if (APPLE) set_target_properties(kritaimage PROPERTIES INSTALL_RPATH "@loader_path/../../../../lib;@loader_path/../lib;@loader_path/../Frameworks;@executable_path/../lib;@executable_path/../Frameworks") endif() Though I sort of feel that it shouldn't be necessary to explicitly set an rpath to something I build. If you are going to install the library, you should set INSTALL_RPATH. Well, the way I set it up, which may be wrong of course, I install all the dependecies to ~/dev/i, then build the main application that uses those dependencies. When developing, I run the app bundle directly, linked to the dependencies in ~/dev/i/lib; when distributing, I use macdeployqt to populate the app bundle with all the dependencies and data. It is partly right. However, you may find it simpler to change the id of libraries before you link against them. For example install_name_tool -id @rpath/libboost_system.dylib libboost_system.dylib And use "install_name_tool -change" for any libraries that link against the library with the changed id, but only if you change the id after linking. Thanks! I think I'm finally beginning to grasp the idea :-) -- Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[Cmake-commits] CMake branch, master, updated. v3.4.1-749-g554c307
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 554c3074556fb8fbf4918fc3e2ea3bef97add1ad (commit) from 56653b81b85c7484a37b6574a1f4b628f462c717 (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 - https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=554c3074556fb8fbf4918fc3e2ea3bef97add1ad commit 554c3074556fb8fbf4918fc3e2ea3bef97add1ad Author: Kitware Robot <kwro...@kitware.com> AuthorDate: Thu Dec 24 00:01:07 2015 -0500 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Thu Dec 24 00:01:07 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7cc5615..7c730e5 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151223) +set(CMake_VERSION_PATCH 20151224) #set(CMake_VERSION_RC 1) --- Summary of changes: Source/CMakeVersion.cmake |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits
Re: [CMake] still having rpath problems on osx
On Wed, 23 Dec 2015, Michael Jackson wrote: Hm... Okay -- so, since I all my dependencies myself as cmake external projects, I guess I want all of them set to rpath. I guess that for boost, with its own build system, I'll need to add a separate fix-up step to my cmake externals project for boost. I have to check how I can fix the dependencies that are still automake/autoconf based. And I'll try what you suggest below for my own project. I have written scripts to do things like that for boost and ITK where the libraries do not have anything like @rpath or the absolute path to the installed library. After installing I run those scripts to “fix” the libraries so when I debug I can just run the application. During packaging I then run CMake’s BundleUtilities to copy in the libraries and adjust the libraries to have @rpath or @executable_path. When fixing up a library make sure you also fix all the dependent libraries that might be there. For things like Boost or ITK their higher level libraries depend on their lower level libraries. Using “otool -L” you can see this. Make sure you update EVERY path in the library. Also using MacDeployQt will NOT fix up any NON-Qt libraries (like Boost, HDF5.. ) so you will still need to run/write something that fixes all of those libraries. For our project we wrote a pure CMake script that does everything we need to fix up our bundles so that everything is self contained. Hm... And it all did work when my project was still Qt4-based and I built on Mavericks... And I've got about 300 libraries in the project, including plugins. Resetting the id of broken libraries and then rebuilding my project works. Are your scripts public so I can take a look and maybe reuse them? -- Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Correct usage of add_library
Thank you very much! :) Managing modules is indeed the very next step for me! I will try that right now! Cédric - Mail original - > De: "Sergei Nikulov"> À: "Cedric Doucet" > Cc: cmake@cmake.org > Envoyé: Mercredi 23 Décembre 2015 13:18:33 > Objet: Re: [CMake] Correct usage of add_library > > 2015-12-23 15:08 GMT+03:00 Cedric Doucet : > > > > Sorry, it was a mistake! > > Everything works fine! > > > > Nice to hear that. > > And another update to my previous answer. > > If your module depends on kernel library (as I understand now it > should be linked to module) you'd better use > > target_link_libraries(module1 kernel) > > https://cmake.org/cmake/help/v3.4/command/target_link_libraries.html > > This dependency also should be resolved first and add kernel library > to linker command. > > > > > > > > > - Mail original - > >> De: "Cedric Doucet" > >> À: "Sergei Nikulov" > >> Cc: cmake@cmake.org > >> Envoyé: Mercredi 23 Décembre 2015 12:59:48 > >> Objet: Re: [CMake] Correct usage of add_library > >> > >> > >> Hello, > >> > >> thank you very much, it works fine! > >> > >> Do you know how to create a target so that > >> > >>make mykernel > >> > >> creates a library libkernel.so? > >> > >> > >> For the moment, I create a library with the command > >> > >>add_library(kernel SHARED ${src}) > >> > >> and I build libkernel.so by typing make. > >> > >> I have found there exists a command add_custom_target but I don't know how > >> to > >> use it. > >> I tried > >> > >>add_custom_target(mykernel DEPENDS kernel) > >> > >> but it does not seems to take my include_directories instructions into > >> account since some headers are not found anymore (they're found when I > >> type > >> 'make'). > >> > >> Cédric > >> > >> - Mail original - > >> > De: "Sergei Nikulov" > >> > À: "Cedric Doucet" > >> > Cc: cmake@cmake.org > >> > Envoyé: Mercredi 23 Décembre 2015 11:38:38 > >> > Objet: Re: [CMake] Correct usage of add_library > >> > > >> > Hello, > >> > > >> > 2015-12-23 13:32 GMT+03:00 Cedric Doucet : > >> > > > >> > > Hello, > >> > > > >> > > I have a code which consist in a kernel and several independent > >> > > modules > >> > > which depend on this kernel. > >> > > I would like to let users build the module they want by typing, for > >> > > example, > >> > > > >> > > make module1 > >> > > > >> > > to build the first module. > >> > > But, as this first module depends on the kernel, I need this kernel to > >> > > be > >> > > built BEFORE module1. > >> > > > >> > > >> > You should add > >> > > >> > add_dependencies(module1 kernel) > >> > > >> > in your module1 CMakeLists.txt > >> > > >> > https://cmake.org/cmake/help/latest/command/add_dependencies.html > >> > > >> > HTH, > >> > > >> > -- > >> > Best Regards, > >> > Sergei Nikulov > >> > > >> -- > >> > >> Powered by www.kitware.com > >> > >> Please keep messages on-topic and check the CMake FAQ at: > >> http://www.cmake.org/Wiki/CMake_FAQ > >> > >> Kitware offers various services to support the CMake community. For more > >> information on each offering, please visit: > >> > >> CMake Support: http://cmake.org/cmake/help/support.html > >> CMake Consulting: http://cmake.org/cmake/help/consulting.html > >> CMake Training Courses: http://cmake.org/cmake/help/training.html > >> > >> Visit other Kitware open-source projects at > >> http://www.kitware.com/opensource/opensource.html > >> > >> Follow this link to subscribe/unsubscribe: > >> http://public.kitware.com/mailman/listinfo/cmake > >> > > > > -- > Best Regards, > Sergei Nikulov > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Modify command in RUN_TESTS
Hi, Is there a way to add options to ctest invocation used in RUN_TESTS target? I'm just trying to pass -jX and -output-on-failure... Regards, J ** This e-mail and any attachments thereto may contain confidential information and/or information protected by intellectual property rights for the exclusive attention of the intended addressees named above. If you have received this transmission in error, please immediately notify the sender by return e-mail and delete this message and its attachments. Unauthorized use, copying or further full or partial distribution of this e-mail or its contents is prohibited. ** -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Correct usage of add_library
Hello, I have a code which consist in a kernel and several independent modules which depend on this kernel. I would like to let users build the module they want by typing, for example, make module1 to build the first module. But, as this first module depends on the kernel, I need this kernel to be built BEFORE module1. My file organization is the following: project_directory/ CMakeLists.txt src/ CMakeLists.txt kernel/ CMakeLists.txt modules/ CMakeLists.txt module1/ module2/ I guess I should use the add_library command to build the kernel first, but I don't know exactly how to do it since there are many possible usages of this command: https://cmake.org/cmake/help/latest/command/add_library.html Does someone know what is the cleanest way to do it? Cédric -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Correct usage of add_library
Hello, 2015-12-23 13:32 GMT+03:00 Cedric Doucet: > > Hello, > > I have a code which consist in a kernel and several independent modules > which depend on this kernel. > I would like to let users build the module they want by typing, for example, > > make module1 > > to build the first module. > But, as this first module depends on the kernel, I need this kernel to be > built BEFORE module1. > You should add add_dependencies(module1 kernel) in your module1 CMakeLists.txt https://cmake.org/cmake/help/latest/command/add_dependencies.html HTH, -- Best Regards, Sergei Nikulov -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake