From post at hendrik-sattler.de Fri Apr 1 01:27:03 2016 From: post at hendrik-sattler.de (Hendrik Sattler) Date: Fri, 01 Apr 2016 07:27:03 +0200 Subject: [CMake] Creating a list of link directories from a variable In-Reply-To: References: Message-ID: <33A3066F-3DE2-4685-B96C-5626A3FA43B6@hendrik-sattler.de> Hi, If the library is a shared object, try to NOT use all those libraries. If they are used in the library but are not part of its public API, you most likely don't need to link them. If you have no missing symbols when linking, you can avoid overlinking you program. If this is a static library, you have a lot more work. For each library without -l, use find_library() and use the library dirs as hints. Do NOT use link_directories(). HS Am 1. April 2016 00:22:09 MESZ, schrieb "Salazar De Troya, Miguel" : >Hello > >I am trying to compile a program with a library that provides a bash >script to generate the dependencies, libraries and the link directories >for the Makefile. I want to generate a CMakeLists.txt that can handle >these dependencies from that library. I have been able to come up with >regexp that can extract the information and put it into a variable with >the dirs or library names separated by comma, for instance: > >INCLUDE_DIRS = > >/g/g92/miguel/code/libmesh_2D/include;/usr/include/curl;/usr/include/glpk;/usr/local/tools/vtk-6.1.0/include/vtk-6.1;/g/g92/miguel/petsc-3.6.2/include;/g/g92/miguel/petsc-3.6.2/miguel-opt/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/hwloc/hwloc191/hwloc/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent/include;/usr/local/tools/openmpi-intel-1.8.4/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi;/usr/local/tools/boost-mpi-1.55.0//include > > >LIBS = > >-lcurl;-lhdf5;-lglpk;-lvtkIOCore-6.1;-lvtkCommonCore-6.1;-lvtkCommonDataModel-6.1;-lvtkFiltersCore-6.1;-lvtkIOXML-6.1;-lvtkImagingCore-6.1;-lvtkIOImage-6.1;-lvtkImagingMath-6.1;-lz;-lpetsc;-lcmumps;-ldmumps;-lsmumps;-lzmumps;-lmumps_common;-lpord;-lscalapack;-lHYPRE;-lml;-llapack;-lblas;-lparmetis;-lmetis;-lX11;-lhwloc;-lssl;-lcrypto;-lmpi_usempif08;-lmpi_usempi_ignore_tkr;-lmpi_mpifh;-lifport;-lifcore;-lm;-lmpi;-limf;-lsvml;-lirng;-lipgo;-ldecimal;-lcilkrts;-lstdc++;-lgcc_s;-lirc;-lpthread;-lirc_s;-ldl;-lmesh_opt > > >LIB_DIRS = > >/usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib > > >These are variables in my environment that I use in CMake with >$ENV{VAR}. How can I use this information for the commands: > >include_directories($ENV{INCLUDE_DIRS}) > >link_directories($ENV{LIB_DIRS}) > >target_link_libraries($ENV{LIBS}) ? > > >It seems that cmake can digest the include directories and the >target_link_libraries (because they appear correctly in the >compilation), but not the link_directories. Why? Also, I?ve read that >it is more correct to use find_library() instead. How would I iterate >over the LIBS? Can I use a single LIB_DIRS (with all the information >above) in the PATHS argument of find_library() > > >Thanks > >Miguel > > >------------------------------------------------------------------------ > >-- > >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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From forumer at smartmobili.com Fri Apr 1 06:16:15 2016 From: forumer at smartmobili.com (forumer at smartmobili.com) Date: Fri, 01 Apr 2016 12:16:15 +0200 Subject: [CMake] Is there any ongoing work to support toolset Clang 3.7 with Microsoft CodeGen (v140_clang_3_7) Message-ID: <5c4c12f04b1012af541c526faef67fb4@smartmobili.com> Hi, Microsoft has released a new toolset using clang for the code analysis and with VS2015 code generator. https://blogs.msdn.microsoft.com/vcblog/2015/12/04/clang-with-microsoft-codegen-in-vs-2015-update-1/ https://blogs.msdn.microsoft.com/vcblog/2016/01/20/clang-with-microsoft-codegen-january-2016-released/ IS there any ongoing work to support the v140_clang_3_7 for VS2015 ? Something like: > cmake -G "Visual Studio 14 2015" -T v140_clang_3_7 For the moment if I want to test I have to use the VS2015 generator and then manually change the Platform Toolset and warnings level Thanks From mavitha.karuppasamy at gmail.com Fri Apr 1 08:44:28 2016 From: mavitha.karuppasamy at gmail.com (Mavitha Sri) Date: Fri, 1 Apr 2016 18:14:28 +0530 Subject: [CMake] Regarding installation of ITK Message-ID: Hello Sir/Madam, Great Day, I am going to use ITK tool kit for my project,So,i tried to install ITK tool in my system.But it showing some error when configuring the CMake. And i have also attached the error.So,please kindly help me to solve this error. ITK version-3.20.1 CMake version-2.8.9 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: error.png Type: image/png Size: 91951 bytes Desc: not available URL: From salazardetro1 at llnl.gov Fri Apr 1 12:25:46 2016 From: salazardetro1 at llnl.gov (Salazar De Troya, Miguel) Date: Fri, 1 Apr 2016 16:25:46 +0000 Subject: [CMake] Creating a list of link directories from a variable In-Reply-To: <33A3066F-3DE2-4685-B96C-5626A3FA43B6@hendrik-sattler.de> References: <33A3066F-3DE2-4685-B96C-5626A3FA43B6@hendrik-sattler.de> Message-ID: Hello Thanks for your response. Is there automatic way to know which libraries my executable will need and which ones it won?t? Why is this the case for only shared libraries? Is it because the linking symbols are already in that shared library and I don?t need to link them again if I?m not using them directly? Miguel From: Hendrik Sattler > Date: Thursday, March 31, 2016 at 10:27 PM To: Miguel Salazar >, "cmake at cmake.org" > Subject: Re: [CMake] Creating a list of link directories from a variable Hi, If the library is a shared object, try to NOT use all those libraries. If they are used in the library but are not part of its public API, you most likely don't need to link them. If you have no missing symbols when linking, you can avoid overlinking you program. If this is a static library, you have a lot more work. For each library without -l, use find_library() and use the library dirs as hints. Do NOT use link_directories(). HS Am 1. April 2016 00:22:09 MESZ, schrieb "Salazar De Troya, Miguel" >: Hello I am trying to compile a program with a library that provides a bash script to generate the dependencies, libraries and the link directories for the Makefile. I want to generate a CMakeLists.txt that can handle these dependencies from that library. I have been able to come up with regexp that can extract the information and put it into a variable with the dirs or library names separated by comma, for instance: INCLUDE_DIRS = /g/g92/miguel/code/libmesh_2D/include;/usr/include/curl;/usr/include/glpk;/usr/local/tools/vtk-6.1.0/include/vtk-6.1;/g/g92/miguel/petsc-3.6.2/include;/g/g92/miguel/petsc-3.6.2/miguel-opt/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/hwloc/hwloc191/hwloc/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent/include;/usr/local/tools/openmpi-intel-1.8.4/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi;/usr/local/tools/boost-mpi-1.55.0//include LIBS = -lcurl;-lhdf5;-lglpk;-lvtkIOCore-6.1;-lvtkCommonCore-6.1;-lvtkCommonDataModel-6.1;-lvtkFiltersCore-6.1;-lvtkIOXML-6.1;-lvtkImagingCore-6.1;-lvtkIOImage-6.1;-lvtkImagingMath-6.1;-lz;-lpetsc;-lcmumps;-ldmumps;-lsmumps;-lzmumps;-lmumps_common;-lpord;-lscalapack;-lHYPRE;-lml;-llapack;-lblas;-lparmetis;-lmetis;-lX11;-lhwloc;-lssl;-lcrypto;-lmpi_usempif08;-lmpi_usempi_ignore_tkr;-lmpi_mpifh;-lifport;-lifcore;-lm;-lmpi;-limf;-lsvml;-lirng;-lipgo;-ldecimal;-lcilkrts;-lstdc++;-lgcc_s;-lirc;-lpthread;-lirc_s;-ldl;-lmesh_opt LIB_DIRS = /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib These are variables in my environment that I use in CMake with $ENV{VAR}. How can I use this information for the commands: include_directories($ENV{INCLUDE_DIRS}) link_directories($ENV{LIB_DIRS}) target_link_libraries($ENV{LIBS}) ? It seems that cmake can digest the include directories and the target_link_libraries (because they appear correctly in the compilation), but not the link_directories. Why? Also, I?ve read that it is more correct to use find_library() instead. How would I iterate over the LIBS? Can I use a single LIB_DIRS (with all the information above) in the PATHS argument of find_library() Thanks Miguel -- Powered by http://secure-web.cisco.com/1SkTeDpqcSTqs7V0Q2yjUdQEsQ1huaYLleRl_DSB40mZrJmSB4Lr6utBlMnP2n8teBgjMf-JqbxyEzxRwI33xdCPfZ4V-R2DL7hRPikFqd9-Rs0WFTInnFgBOVb385LKZzSj7s6rnXOZg-2XG27MJ2-q9sNDHuOdRClebWLFsHqVgj0HGuWMrWGh1kE2S9-TyKuTes7ceD6P0h7C_OsCM_EQXdmhkDGCqyKLK6MRTupY6_HJ1roZBy2Y98SiMF_6LXWUyvKR_raD6crErzRofBLqtBN4vsNeqHBC88J3gYM2BgpkiDnNxonEQy0GonMqIPBKPG9ORW1sEj7-QXajnhYY6cXvu-1TI6aW8FSgTSzZxgdA9zvzoea-DB1 ANk22B/http%3A%2F%2Fwww.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://secure-web.cisco.com/1lI1URY1zHkv6ht2fcVR_WzgnMfOLLtDRhnEZC_L-hBbr0MyYmRVnFbqyae-mLLDa3LRUy3jnmo1S5MImcABjqQXSzuJodnbjzHo7RWpGnMXp14ItTo608Rfa6V21U8szRc88xGOLc_ISZArzbPE2DD3soPvoiUq67hjSNnqbZKvR68LAhF7HNSupJM3L7uVCJAZyue59hncjNCKO7LW5b66INxi4gLED1GTeYz6PUStkNqnZftpECSWslK8EhtW_4COv5-9JASDmn59YbaUl4x38LuUWF9Ezhi7cldke-4fSCwVK8S364ZLxukX51JH_gTzM0pDYj_GB4683VCQ7U3MMDtQeDuU72OIst1qrSHXJWLPBn-CVHrnJPHcHM P8V/http%3A%2F%2Fwww.cmake.org%2FWiki%2FCMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://secure-web.cisco.com/1Qz3n7R5O8bw0CSRD2aEtjVRHTskP3JYupeWWW89VpWzPvN7hkb5gIWI5pJk_cTWsp8XnmQ77NFfNITi4eyz67Z65_0ZB12TnLcwPpXs20eW5MOvDECIVdKk99ysgQfzZ7UZJ9ie38Z2H0GucEIPt6GJY3PEkUAx9rlMp_-34E46uA3rSm5rJVjx2rW7FyudguAM-DSbOihI2VjG4lVa7cKjjyFUAfUHhIiiEYLhTSnyROdgTIorEIF4tzi-U18BTlI9uN1U_YuVSgTh81nQ f1k_AnTZRFIZxa7G8AKN_bclh1YpdXx0E-Kq06ZD1MYiTLN6o8GsSzuoUT7qAJL-FKjb_G8xgO6dBZ4ohg4_8poOqOxDdIKkTBP-nhXVkwmSe/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fsupport.html CMake Consulting: http://secure-web.cisco.com/1eWcD28ESMZFlJWUPWhkBq8KXSsdmSnpldn60uZfqFn_QMxL_1NzQMlujGfPNER7Mq9ZcH7fXFeoMPaPml0UrkV6cwY39IlPti6XF9_god65BZdUy-EULaoOU5XGEBDKEBMm2_5t20nIs6IyqaV25zOWyhVDrQEiGHa-ulvydlMGVXUZqNps1JycByTxAh6J0B8G3TAkN92MfVFbCV8vU24urymXAk1HaFgrULBn0Y-YqrnY_Vj8Tq5xS47rYuelebxpJT0BKhUxvKf-hbRboTJGRQOjgJ-C_Iu A5NPVvSfL-XhCDs7nzUE_E0OXyb_OJpm4Nh-b2EEC2P_tIh8opKKPQf_uC8GYwTPHj0_A4ot8h9sXj3D60fI6iw4Kbht_F/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html CMake Training Courses: http://secure-web.cisco.com/1Ws_Ir6UA-in34UAfzdEg4RJTGWrYp_XmGZCsUXHKnIGN43SCP64aWDni4VaNbznT489ME15yGcFiFkArpBjv6i2swZfUKM5487B2Fd0lgCDYsFtsz0GbsoVrQJmBEUGWEBUgx86fS3bn9AcvuwEXkLzQeNd-42LXR_tvlpH_bCApLEOZXMntGWBBdPvWduEtCwz3QwfNNQNiPZetW2Xkoy3q8GQDSpOZZx5gBiK17P5Kdnzvbai5Xi1YHfVfsq9QlQm365nZogVk6Tt0Vumf8BSudcoJWz5ofCP3l5sU_- Xks9mVhEEtHSE-qGJB1cPmquqwNP6V4LwUOkqHcYq3ZXQPF7diap-5YBfGo4eiX0Zgk6rlFdluAjtjr7wMFN7j/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html Visit other Kitware open-source projects at http://secure-web.cisco.com/1UFZr5nImcHwKfRdWsAKclNUoA9AaFYDCCASJmolI9zgJewqKij0jcFTmy6i8U1dJzggBo8KGXVnbZh7kdWcbS1hhwJikHJYfe1vEyHF6TQOOFOg8QTiF2wM4X0yiRMO4e7RAq1sx7Qsr_aLGtIgJDg9goaII8XN4MZhv2Vgta6FKYt5je-raaStpUC4iWhyoBVi63RTPMWW0fLWPKQk3f9SQK3V-p4bfFcR9Hn_aVzlI7ZaI_B5ii2NC6x2lFtAIKn1l2Uf_epptM9cCf7ZkbHl7uK-lGyPB5w7VavIVMNce4THKWnh7zwepJtS8-ddfTcE0yxEMx4lF-sp6DXCbD8FNROPz95o5pzHnw2YZQBFVA2pHT-NOnoT80NsX7JgX/http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html Follow this link to subscribe/unsubscribe: http://secure-web.cisco.com/1Jl3yAWBiPi-_Ug16DWjk5rAGVXSETXlixkdzBCZkWgB2g4RhLE2dcqHp-_dO8Wyu1_TMU3phTHeU3FfkLHBKHMd3V-qWcBkn_VrYymLV_VbH3YvRxJxPvL_3id4qazZm5B3EtDj-yJQ6bFwzqhXmhDwrqNW8sJB09iUFIF0dVxgCk3LIbTFf97iQuknZ4a5bEy0lZ6QSLE03Kyxvni93Hq0OiQhE9_aLDShnVunar9h0P7GNSGzaOT1Pi43FjhM346RUiauCsjMila62UkjlypuJR9hFaIfy7kzXiV3fA-Ej9Ac6-471fNd0BCY-AP2Ji6YoItgM04GKTBXJC1iYWMx6TDRypcnuJIhsCq324N0W9yEvpeO0Rgh4q0pgwbC3/http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fcmake -------------- next part -------------- An HTML attachment was scrubbed... URL: From post at hendrik-sattler.de Fri Apr 1 13:02:54 2016 From: post at hendrik-sattler.de (Hendrik Sattler) Date: Fri, 01 Apr 2016 19:02:54 +0200 Subject: [CMake] Creating a list of link directories from a variable In-Reply-To: References: <33A3066F-3DE2-4685-B96C-5626A3FA43B6@hendrik-sattler.de> Message-ID: <9BA0A216-9C5F-4F65-B308-8FBBDF47ADA1@hendrik-sattler.de> Hi, yes, exactly. The easiest way to find out is to simply try it. The linker will tell you if some symbols need to be resolved. Static libraries are not linked but only compiled, so the application or library that links to such a static library must do this step. If that library you use would use some established method like pkg-config to expose those values, it would be much easier (if used correctly by the library author). It can differentiate between those cases. HS Am 1. April 2016 18:25:46 MESZ, schrieb "Salazar De Troya, Miguel" : >Hello > >Thanks for your response. Is there automatic way to know which >libraries my executable will need and which ones it won?t? Why is this >the case for only shared libraries? Is it because the linking symbols >are already in that shared library and I don?t need to link them again >if I?m not using them directly? > >Miguel >From: Hendrik Sattler >> >Date: Thursday, March 31, 2016 at 10:27 PM >To: Miguel Salazar >>, >"cmake at cmake.org" >> >Subject: Re: [CMake] Creating a list of link directories from a >variable > >Hi, > >If the library is a shared object, try to NOT use all those libraries. >If they are used in the library but are not part of its public API, you >most likely don't need to link them. If you have no missing symbols >when linking, you can avoid overlinking you program. > >If this is a static library, you have a lot more work. For each library >without -l, use find_library() and use the library dirs as hints. Do >NOT use link_directories(). > >HS > > > > >Am 1. April 2016 00:22:09 MESZ, schrieb "Salazar De Troya, Miguel" >>: >Hello > >I am trying to compile a program with a library that provides a bash >script to generate the dependencies, libraries and the link directories >for the Makefile. I want to generate a CMakeLists.txt that can handle >these dependencies from that library. I have been able to come up with >regexp that can extract the information and put it into a variable with >the dirs or library names separated by comma, for instance: > >INCLUDE_DIRS = > >/g/g92/miguel/code/libmesh_2D/include;/usr/include/curl;/usr/include/glpk;/usr/local/tools/vtk-6.1.0/include/vtk-6.1;/g/g92/miguel/petsc-3.6.2/include;/g/g92/miguel/petsc-3.6.2/miguel-opt/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/hwloc/hwloc191/hwloc/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent/include;/usr/local/tools/openmpi-intel-1.8.4/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi;/usr/local/tools/boost-mpi-1.55.0//include > > >LIBS = > >-lcurl;-lhdf5;-lglpk;-lvtkIOCore-6.1;-lvtkCommonCore-6.1;-lvtkCommonDataModel-6.1;-lvtkFiltersCore-6.1;-lvtkIOXML-6.1;-lvtkImagingCore-6.1;-lvtkIOImage-6.1;-lvtkImagingMath-6.1;-lz;-lpetsc;-lcmumps;-ldmumps;-lsmumps;-lzmumps;-lmumps_common;-lpord;-lscalapack;-lHYPRE;-lml;-llapack;-lblas;-lparmetis;-lmetis;-lX11;-lhwloc;-lssl;-lcrypto;-lmpi_usempif08;-lmpi_usempi_ignore_tkr;-lmpi_mpifh;-lifport;-lifcore;-lm;-lmpi;-limf;-lsvml;-lirng;-lipgo;-ldecimal;-lcilkrts;-lstdc++;-lgcc_s;-lirc;-lpthread;-lirc_s;-ldl;-lmesh_opt > > >LIB_DIRS = > >/usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib > > >These are variables in my environment that I use in CMake with >$ENV{VAR}. How can I use this information for the commands: > >include_directories($ENV{INCLUDE_DIRS}) > >link_directories($ENV{LIB_DIRS}) > >target_link_libraries($ENV{LIBS}) ? > > >It seems that cmake can digest the include directories and the >target_link_libraries (because they appear correctly in the >compilation), but not the link_directories. Why? Also, I?ve read that >it is more correct to use find_library() instead. How would I iterate >over the LIBS? Can I use a single LIB_DIRS (with all the information >above) in the PATHS argument of find_library() > > >Thanks > >Miguel > >-- > >Powered by >http://secure-web.cisco.com/1SkTeDpqcSTqs7V0Q2yjUdQEsQ1huaYLleRl_DSB40mZrJmSB4Lr6utBlMnP2n8teBgjMf-JqbxyEzxRwI33xdCPfZ4V-R2DL7hRPikFqd9-Rs0WFTInnFgBOVb385LKZzSj7s6rnXOZg-2XG27MJ2-q9sNDHuOdRClebWLFsHqVgj0HGuWMrWGh1kE2S9-TyKuTes7ceD6P0h7C_OsCM_EQXdmhkDGCqyKLK6MRTupY6_HJ1roZBy2Y98SiMF_6LXWUyvKR_raD6crErzRofBLqtBN4vsNeqHBC88J3gYM2BgpkiDnNxonEQy0GonMqIPBKPG9ORW1sEj7-QXajnhYY6cXvu-1TI6aW8FSgTSzZxgdA9zvzoea-DB1 > >ANk22B/http%3A%2F%2Fwww.kitware.com > >Please keep messages on-topic and check the CMake FAQ at: >http://secure-web.cisco.com/1lI1URY1zHkv6ht2fcVR_WzgnMfOLLtDRhnEZC_L-hBbr0MyYmRVnFbqyae-mLLDa3LRUy3jnmo1S5MImcABjqQXSzuJodnbjzHo7RWpGnMXp14ItTo608Rfa6V21U8szRc88xGOLc_ISZArzbPE2DD3soPvoiUq67hjSNnqbZKvR68LAhF7HNSupJM3L7uVCJAZyue59hncjNCKO7LW5b66INxi4gLED1GTeYz6PUStkNqnZftpECSWslK8EhtW_4COv5-9JASDmn59YbaUl4x38LuUWF9Ezhi7cldke-4fSCwVK8S364ZLxukX51JH_gTzM0pDYj_GB4683VCQ7U3MMDtQeDuU72OIst1qrSHXJWLPBn-CVHrnJPHcHM > >P8V/http%3A%2F%2Fwww.cmake.org%2FWiki%2FCMake_FAQ > >Kitware offers various services to support the CMake community. For >more information on each offering, please visit: > >CMake Support: >http://secure-web.cisco.com/1Qz3n7R5O8bw0CSRD2aEtjVRHTskP3JYupeWWW89VpWzPvN7hkb5gIWI5pJk_cTWsp8XnmQ77NFfNITi4eyz67Z65_0ZB12TnLcwPpXs20eW5MOvDECIVdKk99ysgQfzZ7UZJ9ie38Z2H0GucEIPt6GJY3PEkUAx9rlMp_-34E46uA3rSm5rJVjx2rW7FyudguAM-DSbOihI2VjG4lVa7cKjjyFUAfUHhIiiEYLhTSnyROdgTIorEIF4tzi-U18BTlI9uN1U_YuVSgTh81nQ > >f1k_AnTZRFIZxa7G8AKN_bclh1YpdXx0E-Kq06ZD1MYiTLN6o8GsSzuoUT7qAJL-FKjb_G8xgO6dBZ4ohg4_8poOqOxDdIKkTBP-nhXVkwmSe/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fsupport.html >CMake Consulting: >http://secure-web.cisco.com/1eWcD28ESMZFlJWUPWhkBq8KXSsdmSnpldn60uZfqFn_QMxL_1NzQMlujGfPNER7Mq9ZcH7fXFeoMPaPml0UrkV6cwY39IlPti6XF9_god65BZdUy-EULaoOU5XGEBDKEBMm2_5t20nIs6IyqaV25zOWyhVDrQEiGHa-ulvydlMGVXUZqNps1JycByTxAh6J0B8G3TAkN92MfVFbCV8vU24urymXAk1HaFgrULBn0Y-YqrnY_Vj8Tq5xS47rYuelebxpJT0BKhUxvKf-hbRboTJGRQOjgJ-C_Iu > >A5NPVvSfL-XhCDs7nzUE_E0OXyb_OJpm4Nh-b2EEC2P_tIh8opKKPQf_uC8GYwTPHj0_A4ot8h9sXj3D60fI6iw4Kbht_F/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html >CMake Training Courses: >http://secure-web.cisco.com/1Ws_Ir6UA-in34UAfzdEg4RJTGWrYp_XmGZCsUXHKnIGN43SCP64aWDni4VaNbznT489ME15yGcFiFkArpBjv6i2swZfUKM5487B2Fd0lgCDYsFtsz0GbsoVrQJmBEUGWEBUgx86fS3bn9AcvuwEXkLzQeNd-42LXR_tvlpH_bCApLEOZXMntGWBBdPvWduEtCwz3QwfNNQNiPZetW2Xkoy3q8GQDSpOZZx5gBiK17P5Kdnzvbai5Xi1YHfVfsq9QlQm365nZogVk6Tt0Vumf8BSudcoJWz5ofCP3l5sU_- > >Xks9mVhEEtHSE-qGJB1cPmquqwNP6V4LwUOkqHcYq3ZXQPF7diap-5YBfGo4eiX0Zgk6rlFdluAjtjr7wMFN7j/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html > >Visit other Kitware open-source projects at >http://secure-web.cisco.com/1UFZr5nImcHwKfRdWsAKclNUoA9AaFYDCCASJmolI9zgJewqKij0jcFTmy6i8U1dJzggBo8KGXVnbZh7kdWcbS1hhwJikHJYfe1vEyHF6TQOOFOg8QTiF2wM4X0yiRMO4e7RAq1sx7Qsr_aLGtIgJDg9goaII8XN4MZhv2Vgta6FKYt5je-raaStpUC4iWhyoBVi63RTPMWW0fLWPKQk3f9SQK3V-p4bfFcR9Hn_aVzlI7ZaI_B5ii2NC6x2lFtAIKn1l2Uf_epptM9cCf7ZkbHl7uK-lGyPB5w7VavIVMNce4THKWnh7zwepJtS8-ddfTcE0yxEMx4lF-sp6DXCbD8FNROPz95o5pzHnw2YZQBFVA2pHT-NOnoT80NsX7JgX/http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html > >Follow this link to > > subscribe/unsubscribe: >http://secure-web.cisco.com/1Jl3yAWBiPi-_Ug16DWjk5rAGVXSETXlixkdzBCZkWgB2g4RhLE2dcqHp-_dO8Wyu1_TMU3phTHeU3FfkLHBKHMd3V-qWcBkn_VrYymLV_VbH3YvRxJxPvL_3id4qazZm5B3EtDj-yJQ6bFwzqhXmhDwrqNW8sJB09iUFIF0dVxgCk3LIbTFf97iQuknZ4a5bEy0lZ6QSLE03Kyxvni93Hq0OiQhE9_aLDShnVunar9h0P7GNSGzaOT1Pi43FjhM346RUiauCsjMila62UkjlypuJR9hFaIfy7kzXiV3fA-Ej9Ac6-471fNd0BCY-AP2Ji6YoItgM04GKTBXJC1iYWMx6TDRypcnuJIhsCq324N0W9yEvpeO0Rgh4q0pgwbC3/http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fcmake > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From scott at towel42.com Fri Apr 1 13:04:37 2016 From: scott at towel42.com (Scott Aron Bloom) Date: Fri, 1 Apr 2016 17:04:37 +0000 Subject: [CMake] Building a tool immediately so it can be used later in same CMake run In-Reply-To: References: Message-ID: I had asked a similar question 2 weeks or so ago. The conclusion, which DID work well was the following. Rather than having 1 ?large? cmake project with sub libraries. Use the ?super-project? system, where you do an ExternalProject_Add for each of the projects. Then for the projects that need the ?first executable? you list that project as a dependency Scott From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Craig Scott Sent: Thursday, March 31, 2016 4:53 PM To: cmake at cmake.org Subject: [CMake] Building a tool immediately so it can be used later in same CMake run All, I originally planned to ask this question directly on this mailing list, but it got a bit more involved, so I posted it to stackoverflow instead. I'm interested if anyone can shed some more authoritative light on the proposed method for the following question: http://stackoverflow.com/q/36084785/1938798 Short version: invoke a nested cmake-and-build immediately within the main CMake run to build a specific target via execute_process(). This makes that tool available for use still within the same (main) CMake run. An ExternalProject-based technique would normally be a better solution, but in this particular case, that wasn't possible. I'd be interested if anyone can confirm whether the suggested approach is guaranteed to be safe for all generators and platforms, or whether there are other factors I have not considered in the proposed technique. Cheers -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From salazardetro1 at llnl.gov Fri Apr 1 13:50:11 2016 From: salazardetro1 at llnl.gov (Salazar De Troya, Miguel) Date: Fri, 1 Apr 2016 17:50:11 +0000 Subject: [CMake] Creating a list of link directories from a variable In-Reply-To: <9BA0A216-9C5F-4F65-B308-8FBBDF47ADA1@hendrik-sattler.de> References: <33A3066F-3DE2-4685-B96C-5626A3FA43B6@hendrik-sattler.de> <9BA0A216-9C5F-4F65-B308-8FBBDF47ADA1@hendrik-sattler.de> Message-ID: The library that I am using uses libtool for this purpose I think. This is what the Makefile to build the application looks like: $(notdir $(target)): $(objects) @echo "Linking "$@"..." @$(libmesh_LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=link \ $(libmesh_CXX) $(libmesh_CXXFLAGS) $(objects) -o $@ $(libmesh_LIBS) $(libmesh_LDFLAGS) $(EXTERNAL_FLAGS) where $(libmesh_LIBTOOL) is the libtool executable, $(libmesh_CXX) is the compiler, etc. $(libmesh_LIBS) is the same I described before, I.e., all the libraries the library I am using uses. Is there anyway I can use libtool within cmake? Thanks Miguel From: Hendrik Sattler > Date: Friday, April 1, 2016 at 10:02 AM To: Miguel Salazar >, "cmake at cmake.org" > Subject: Re: [CMake] Creating a list of link directories from a variable Hi, yes, exactly. The easiest way to find out is to simply try it. The linker will tell you if some symbols need to be resolved. Static libraries are not linked but only compiled, so the application or library that links to such a static library must do this step. If that library you use would use some established method like pkg-config to expose those values, it would be much easier (if used correctly by the library author). It can differentiate between those cases. HS Am 1. April 2016 18:25:46 MESZ, schrieb "Salazar De Troya, Miguel" >: Hello Thanks for your response. Is there automatic way to know which libraries my executable will need and which ones it won?t? Why is this the case for only shared libraries? Is it because the linking symbols are already in that shared library and I don?t need to link them again if I?m not using them directly? Miguel From: Hendrik Sattler > Date: Thursday, March 31, 2016 at 10:27 PM To: Miguel Salazar >, "cmake at cmake.org" > Subject: Re: [CMake] Creating a list of link directories from a variable Hi, If the library is a shared object, try to NOT use all those libraries. If they are used in the library but are not part of its public API, you most likely don't need to link them. If you have no missing symbols when linking, you can avoid overlinking you program. If this is a static library, you have a lot more work. For each library without -l, use find_library() and use the library dirs as hints. Do NOT use link_directories(). HS Am 1. April 2016 00:22:09 MESZ, schrieb "Salazar De Troya, Miguel" >: Hello I am trying to compile a program with a library that provides a bash script to generate the dependencies, libraries and the link directories for the Makefile. I want to generate a CMakeLists.txt that can handle these dependencies from that library. I have been able to come up with regexp that can extract the information and put it into a variable with the dirs or library names separated by comma, for instance: INCLUDE_DIRS = /g/g92/miguel/code/libmesh_2D/include;/usr/include/curl;/usr/include/glpk;/usr/local/tools/vtk-6.1.0/include/vtk-6.1;/g/g92/miguel/petsc-3.6.2/include;/g/g92/miguel/petsc-3.6.2/miguel-opt/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/hwloc/hwloc191/hwloc/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi/opal/mca/event/libevent2021/libevent/include;/usr/local/tools/openmpi-intel-1.8.4/include;/usr/local/tools/openmpi-intel-1.8.4/include/openmpi;/usr/local/tools/boost-mpi-1.55.0//include LIBS = -lcurl;-lhdf5;-lglpk;-lvtkIOCore-6.1;-lvtkCommonCore-6.1;-lvtkCommonDataModel-6.1;-lvtkFiltersCore-6.1;-lvtkIOXML-6.1;-lvtkImagingCore-6.1;-lvtkIOImage-6.1;-lvtkImagingMath-6.1;-lz;-lpetsc;-lcmumps;-ldmumps;-lsmumps;-lzmumps;-lmumps_common;-lpord;-lscalapack;-lHYPRE;-lml;-llapack;-lblas;-lparmetis;-lmetis;-lX11;-lhwloc;-lssl;-lcrypto;-lmpi_usempif08;-lmpi_usempi_ignore_tkr;-lmpi_mpifh;-lifport;-lifcore;-lm;-lmpi;-limf;-lsvml;-lirng;-lipgo;-ldecimal;-lcilkrts;-lstdc++;-lgcc_s;-lirc;-lpthread;-lirc_s;-ldl;-lmesh_opt LIB_DIRS = /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib These are variables in my environment that I use in CMake with $ENV{VAR}. How can I use this information for the commands: include_directories($ENV{INCLUDE_DIRS}) link_directories($ENV{LIB_DIRS}) target_link_libraries($ENV{LIBS}) ? It seems that cmake can digest the include directories and the target_link_libraries (because they appear correctly in the compilation), but not the link_directories. Why? Also, I?ve read that it is more correct to use find_library() instead. How would I iterate over the LIBS? Can I use a single LIB_DIRS (with all the information above) in the PATHS argument of find_library() Thanks Miguel -- Powered by http://secure-web.cisco.com/1SkTeDpqcSTqs7V0Q2yjUdQEsQ1huaYLleRl_DSB40mZrJmSB4Lr6utBlMnP2n8teBgjMf-JqbxyEzxRwI33xdCPfZ4V-R2DL7hRPikFqd9-Rs0WFTInnFgBOVb385LKZzSj7s6rnXOZg-2XG27MJ2-q9sNDHuOdRClebWLFsHqVgj0HGuWMrWGh1kE2S9-TyKuTes7ceD6P0h7C_OsCM_EQXdmhkDGCqyKLK6MRTupY6_HJ1roZBy2Y98SiMF_6LXWUyvKR_raD6crErzRofBLqtBN4vsNeqHBC88J3gYM2BgpkiDnNxonEQy0GonMqIPBKPG9ORW1sEj7-QXajnhYY6cXvu-1TI6aW8FSgTSzZxgdA9zvzoea-DB1 ANk22B/http%3A%2F%2Fhttp://secure-web.cisco.com/1_G8E11DjkWSEZF1X0bDL0XQ6no1ns19oUE5HkwkJW_OM4jsX4q3ZXYR7UTOIqaoAjTR6ytCzZdu4WPPoUXG8puGesXmBd5HDxLeW3uHxWnWMJ9ykzRvQnp_V5huyOikMeviO6mRfs1PmY_g_AACDuNomxbRIczMESxWgsufu_Eg7w3TyPfXfUblqfme1zjQ9MtLTmJCkfRDWNVpUPVneOKOL8KQR1qbchCVHJp_4WJtyCaJnPclfRtqX6PPovdxb589UUDv2aAWC2KvE0JAPZX82sLJoWTy3VncHP0HfE92zxCeA2hj3lJENb55aIFfoa-FPOU8jPfh3XCptObzjorZs7oTkdxcyCtHP-kCaqSX9y0WHdZaZar7B9TUlk9R7/http%3A%2F%2Fwww.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://secure-web.cisco.com/1lI1URY1zHkv6ht2fcVR_WzgnMfOLLtDRhnEZC_L-hBbr0MyYmRVnFbqyae-mLLDa3LRUy3jnmo1S5MImcABjqQXSzuJodnbjzHo7RWpGnMXp14ItTo608Rfa6V21U8szRc88xGOLc_ISZArzbPE2DD3soPvoiUq67hjSNnqbZKvR68LAhF7HNSupJM3L7uVCJAZyue59hncjNCKO7LW5b66INxi4gLED1GTeYz6PUStkNqnZftpECSWslK8EhtW_4COv5-9JASDmn59YbaUl4x38LuUWF9Ezhi7cldke-4fSCwVK8S364ZLxukX51JH_gTzM0pDYj_GB4683VCQ7U3MMDtQeDuU72OIst1qrSHXJWLPBn-CVHrnJPHcHM P8V/http%3A%2F%2Fhttp://secure-web.cisco.com/1Bkvr0G6CjmhxjbPWZjz1f9tENDvZUFASRjcU_7Q88EnpJI2XsrOFU0c5olP28krrrDUTl-hCDKmdwgP32nHMUj1foppf3czHNXklLqkXZyhEKrV-fGy-G_36c_9Y7k1WucIAXCwsYtqxJbenF4adv1-3u9LXCPKp6mpA8A_9gFGBPOZTuBWuBWyDEGDQnZi0Avju9U3NEf_FiQOymwbZNkAoDAiFgGLMAe24US9Rn4R3iYoryMbv2jhP8_to2tDnH3s8MDcOP6U0cvZIrxMI9TgLThqj0PMYaqOnJ3DjDWzmVtBjA7M5875h2gSuoxxJD9yOIyGkMDycS_MYMeeBHdqGhBSNY__IDKjLPLuzV0vlOGd4ae_32k_qphC01h_W/http%3A%2F%2Fwww.cmake.org%2FWiki%2FCMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://secure-web.cisco.com/1Qz3n7R5O8bw0CSRD2aEtjVRHTskP3JYupeWWW89VpWzPvN7hkb5gIWI5pJk_cTWsp8XnmQ77NFfNITi4eyz67Z65_0ZB12TnLcwPpXs20eW5MOvDECIVdKk99ysgQfzZ7UZJ9ie38Z2H0GucEIPt6GJY3PEkUAx9rlMp_-34E46uA3rSm5rJVjx2rW7FyudguAM-DSbOihI2VjG4lVa7cKjjyFUAfUHhIiiEYLhTSnyROdgTIorEIF4tzi-U18BTlI9uN1U_YuVSgTh81nQ f1k_AnTZRFIZxa7G8AKN_bclh1YpdXx0E-Kq06ZD1MYiTLN6o8GsSzuoUT7qAJL-FKjb_G8xgO6dBZ4ohg4_8poOqOxDdIKkTBP-nhXVkwmSe/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fsupport.html CMake Consulting: http://secure-web.cisco.com/1eWcD28ESMZFlJWUPWhkBq8KXSsdmSnpldn60uZfqFn_QMxL_1NzQMlujGfPNER7Mq9ZcH7fXFeoMPaPml0UrkV6cwY39IlPti6XF9_god65BZdUy-EULaoOU5XGEBDKEBMm2_5t20nIs6IyqaV25zOWyhVDrQEiGHa-ulvydlMGVXUZqNps1JycByTxAh6J0B8G3TAkN92MfVFbCV8vU24urymXAk1HaFgrULBn0Y-YqrnY_Vj8Tq5xS47rYuelebxpJT0BKhUxvKf-hbRboTJGRQOjgJ-C_Iu A5NPVvSfL-XhCDs7nzUE_E0OXyb_OJpm4Nh-b2EEC2P_tIh8opKKPQf_uC8GYwTPHj0_A4ot8h9sXj3D60fI6iw4Kbht_F/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html CMake Training Courses: http://secure-web.cisco.com/1Ws_Ir6UA-in34UAfzdEg4RJTGWrYp_XmGZCsUXHKnIGN43SCP64aWDni4VaNbznT489ME15yGcFiFkArpBjv6i2swZfUKM5487B2Fd0lgCDYsFtsz0GbsoVrQJmBEUGWEBUgx86fS3bn9AcvuwEXkLzQeNd-42LXR_tvlpH_bCApLEOZXMntGWBBdPvWduEtCwz3QwfNNQNiPZetW2Xkoy3q8GQDSpOZZx5gBiK17P5Kdnzvbai5Xi1YHfVfsq9QlQm365nZogVk6Tt0Vumf8BSudcoJWz5ofCP3l5sU_- Xks9mVhEEtHSE-qGJB1cPmquqwNP6V4LwUOkqHcYq3ZXQPF7diap-5YBfGo4eiX0Zgk6rlFdluAjtjr7wMFN7j/http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html Visit other Kitware open-source projects at http://secure-web.cisco.com/1UFZr5nImcHwKfRdWsAKclNUoA9AaFYDCCASJmolI9zgJewqKij0jcFTmy6i8U1dJzggBo8KGXVnbZh7kdWcbS1hhwJikHJYfe1vEyHF6TQOOFOg8QTiF2wM4X0yiRMO4e7RAq1sx7Qsr_aLGtIgJDg9goaII8XN4MZhv2Vgta6FKYt5je-raaStpUC4iWhyoBVi63RTPMWW0fLWPKQk3f9SQK3V-p4bfFcR9Hn_aVzlI7ZaI_B5ii2NC6x2lFtAIKn1l2Uf_epptM9cCf7ZkbHl7uK-lGyPB5w7VavIVMNce4THKWnh7zwepJtS8-ddfTcE0yxEMx4lF-sp6DXCbD8FNROPz95o5pzHnw2YZQBFVA2pHT-NOnoT80NsX7JgX/http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html Follow this link to subscribe/unsubscribe: http://secure-web.cisco.com/1Jl3yAWBiPi-_Ug16DWjk5rAGVXSETXlixkdzBCZkWgB2g4RhLE2dcqHp-_dO8Wyu1_TMU3phTHeU3FfkLHBKHMd3V-qWcBkn_VrYymLV_VbH3YvRxJxPvL_3id4qazZm5B3EtDj-yJQ6bFwzqhXmhDwrqNW8sJB09iUFIF0dVxgCk3LIbTFf97iQuknZ4a5bEy0lZ6QSLE03Kyxvni93Hq0OiQhE9_aLDShnVunar9h0P7GNSGzaOT1Pi43FjhM346RUiauCsjMila62UkjlypuJR9hFaIfy7kzXiV3fA-Ej9Ac6-471fNd0BCY-AP2Ji6YoItgM04GKTBXJC1iYWMx6TDRypcnuJIhsCq324N0W9yEvpeO0Rgh4q0pgwbC3/http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fcmake -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrawd2 at gmail.com Fri Apr 1 14:07:40 2016 From: mrawd2 at gmail.com (Fedja Jeleskovic) Date: Fri, 1 Apr 2016 14:07:40 -0400 Subject: [CMake] Parsing command line arguments from the make Message-ID: Since I am converting existing makefile project to use cmake instead I need to accept values that come from command line which looks like this: VARIABLE_NAME="/home/user/project" make ENV=VERSION_2 First one is used like this: include $(VARIABLE_NAME)/Makefile.include Second one has this code that triggers different paths later: ifneq ($(ENV),) DEPLOYMENT_VERSION=$(ENV) endif How do I do this in cmake? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrawd2 at gmail.com Fri Apr 1 15:22:15 2016 From: mrawd2 at gmail.com (Fedja Jeleskovic) Date: Fri, 1 Apr 2016 15:22:15 -0400 Subject: [CMake] Parsing command line arguments from the make In-Reply-To: References: Message-ID: To make my question a bit more clear, I am trying to figure out how to add these things so my make will be able to use them. If I need environment variable inside the cmake, I could use $ENV{VARIABLE_NAME} and have it. The problem is to create the code inside the CMakeLists.txt, so that generated Makefile will be able to get before and after arguments that are supplied. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tamas.kenez at gmail.com Fri Apr 1 15:25:50 2016 From: tamas.kenez at gmail.com (=?UTF-8?B?VGFtw6FzIEtlbsOpeg==?=) Date: Fri, 1 Apr 2016 21:25:50 +0200 Subject: [CMake] Building a tool immediately so it can be used later in same CMake run In-Reply-To: References: Message-ID: Craig, My cmake-based build system in my company's CI framework works exactly that way: there's a generic cmake script[1] (invoked with cmake -P) that reads in a file which contains repo-urls and build parameters for 50+ projects and builds them for 3 platforms (linux, win, mac) 5 compilers (cross-compilers, too) invoking child cmake builds with execute_process. This is done after each push and one daily clean build. I've never had any problems with that approach. On the other hand, the system was originally designed with ExternalProject and I had many problems. [1]: https://github.com/tamaskenez/centralbuilder Tamas On Fri, Apr 1, 2016 at 1:53 AM, Craig Scott wrote: > All, > > I originally planned to ask this question directly on this mailing list, > but it got a bit more involved, so I posted it to stackoverflow instead. > I'm interested if anyone can shed some more authoritative light on the > proposed method for the following question: > > http://stackoverflow.com/q/36084785/1938798 > > *Short version*: invoke a nested cmake-and-build immediately within the > main CMake run to build a specific target via execute_process(). This makes > that tool available for use still within the same (main) CMake run. An > ExternalProject-based technique would normally be a better solution, but in > this particular case, that wasn't possible. > > I'd be interested if anyone can confirm whether the suggested approach is > guaranteed to be safe for all generators and platforms, or whether there > are other factors I have not considered in the proposed technique. > > Cheers > > -- > Craig Scott > Melbourne, Australia > http://crascit.com > > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tamas.kenez at gmail.com Sat Apr 2 11:09:06 2016 From: tamas.kenez at gmail.com (=?UTF-8?B?VGFtw6FzIEtlbsOpeg==?=) Date: Sat, 2 Apr 2016 17:09:06 +0200 Subject: [CMake] Building a tool immediately so it can be used later in same CMake run In-Reply-To: References: Message-ID: Craig, I'm sorry for my previous answer which I wrote in haste. Now I've read your SO post and realized the question is a bit more complex then "is execute_process safe instead of ExternalProject". Anyway I still think your approach is basically correct. I have the following comments: - I wouldn't re-use the current build dir and would build mycomp always in it's own build dir. Also, I'd always use the plain default cmake generator (which is a must when crosscompiling anyway). No need to forward any settings to it from the superbuild. Also, I'd always build the Release config for mycomp. - You could "install(TARGETS mycomp DESTINATION bin)" in your EARLY_BUILD then later use "find_program(mycomp_EXECUTABLE mycomp ...) later to save guessing the executable's name. Tamas On Fri, Apr 1, 2016 at 9:25 PM, Tam?s Ken?z wrote: > Craig, > > My cmake-based build system in my company's CI framework works exactly > that way: there's a generic cmake script[1] (invoked with cmake -P) that > reads in a file which contains repo-urls and build parameters for 50+ > projects and builds them for 3 platforms (linux, win, mac) 5 compilers > (cross-compilers, too) invoking child cmake builds with execute_process. > This is done after each push and one daily clean build. > > I've never had any problems with that approach. > > On the other hand, the system was originally designed with ExternalProject > and I had many problems. > > [1]: https://github.com/tamaskenez/centralbuilder > > Tamas > > > > On Fri, Apr 1, 2016 at 1:53 AM, Craig Scott > wrote: > >> All, >> >> I originally planned to ask this question directly on this mailing list, >> but it got a bit more involved, so I posted it to stackoverflow instead. >> I'm interested if anyone can shed some more authoritative light on the >> proposed method for the following question: >> >> http://stackoverflow.com/q/36084785/1938798 >> >> *Short version*: invoke a nested cmake-and-build immediately within the >> main CMake run to build a specific target via execute_process(). This makes >> that tool available for use still within the same (main) CMake run. An >> ExternalProject-based technique would normally be a better solution, but in >> this particular case, that wasn't possible. >> >> I'd be interested if anyone can confirm whether the suggested approach is >> guaranteed to be safe for all generators and platforms, or whether there >> are other factors I have not considered in the proposed technique. >> >> Cheers >> >> -- >> Craig Scott >> Melbourne, Australia >> http://crascit.com >> >> -- >> >> 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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.mccormick at kitware.com Sat Apr 2 12:03:27 2016 From: matt.mccormick at kitware.com (Matt McCormick) Date: Sat, 2 Apr 2016 12:03:27 -0400 Subject: [CMake] Regarding installation of ITK In-Reply-To: References: Message-ID: Hello, Welcome to ITK! Please follow the steps described here to get started: http://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch2.html#x27-170002 Please also use the latest version of ITK (4.9.0) and CMake (3.5.1). Thanks, Matt On Fri, Apr 1, 2016 at 8:44 AM, Mavitha Sri wrote: > Hello Sir/Madam, > > Great Day, > > I am going to use ITK tool kit for my project,So,i tried to install ITK > tool in my system.But it showing some error when configuring the CMake. And > i have also attached the error.So,please kindly help me to solve this > error. > > ITK version-3.20.1 > CMake version-2.8.9 > > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From irwin at beluga.phys.uvic.ca Sat Apr 2 12:58:25 2016 From: irwin at beluga.phys.uvic.ca (Alan W. Irwin) Date: Sat, 2 Apr 2016 09:58:25 -0700 (PDT) Subject: [CMake] Regarding installation of ITK In-Reply-To: References: Message-ID: On 2016-04-02 12:03-0400 Matt McCormick wrote: > Hello, > > Welcome to ITK! > > Please follow the steps described here to get started: > > > http://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch2.html#x27-170002 > > Please also use the latest version of ITK (4.9.0) and CMake (3.5.1). > > Thanks, > Matt Hi Matt: There is likely a name clash here since your ITK is the Insight Segmentation and Registration Toolkit while the original poster probably (based on the version number he is using) was referring to the ITK that is a subset of the [incr Tcl] project. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ From andrew.pennebaker at gmail.com Sun Apr 3 03:37:16 2016 From: andrew.pennebaker at gmail.com (Andrew Pennebaker) Date: Sun, 3 Apr 2016 02:37:16 -0500 Subject: [CMake] infer integration Message-ID: Are there plans to make cmake-generated Makefile's more compatible with the fbinfer linter? http://fbinfer.com/ In the meantime, could someone give a fully qualified example of how to run infer against cmake-generated Makefile's? There are a few examples online, but recent versions of infer appear to have moved the old .../infer/lib/capture/clang wrapper somewhere else. -- Cheers, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Sun Apr 3 04:49:10 2016 From: craig.scott at crascit.com (Craig Scott) Date: Sun, 3 Apr 2016 18:49:10 +1000 Subject: [CMake] Documenting the -H and -B options Message-ID: It would seem that the undocumented -H and -B options of cmake are fairly well known and it is likely they are being widely used by now. Is there any reason they cannot become officially documented options? A quick bit of googling and searching on StackOverflow suggests they perhaps ought to graduate to formally supported options. -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From imbacen at gmail.com Sun Apr 3 07:07:15 2016 From: imbacen at gmail.com (cen) Date: Sun, 3 Apr 2016 13:07:15 +0200 Subject: [CMake] Documenting the -H and -B options In-Reply-To: References: Message-ID: <5700F963.4060801@gmail.com> Funny you say that, -H and -B options are the only ones I actually use all the time. I never really understood why these are not documented or part of the man page. Is there an official reasoning behind this? On 3. 04. 2016 10:49, Craig Scott wrote: > It would seem that the undocumented -H and -B options of cmake are > fairly well known and it is likely they are being widely used by now. Is > there any reason they cannot become officially documented options? A > quick bit of googling and searching on StackOverflow suggests they > perhaps ought to graduate to formally supported options. > > -- > Craig Scott > Melbourne, Australia > http://crascit.com > > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From andrew.pennebaker at gmail.com Sun Apr 3 13:41:41 2016 From: andrew.pennebaker at gmail.com (Andrew Pennebaker) Date: Sun, 3 Apr 2016 12:41:41 -0500 Subject: [CMake] VERBATIM support for add_test()? Message-ID: Could cmake get VERBATIM support for add_test(), so that common shell techniques like < > I/O redirection can work in add_test()'s? Workaround: sh -c "..." everything. -- Cheers, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas at junovagen.se Sun Apr 3 17:38:33 2016 From: thomas at junovagen.se (Thomas Nilsson) Date: Sun, 03 Apr 2016 23:38:33 +0200 Subject: [CMake] Clang on Cygwin don't build 'dll.a' In-Reply-To: <56F23ABD.9010306@junovagen.se> References: <56F23ABD.9010306@junovagen.se> Message-ID: <57018D59.5090605@junovagen.se> Thomas Nilsson skrev: > I'm trying to build a CMake project using clang instead of gcc. The > project is cross-platform and builds cleanly on Cygwin with gcc. With > Clang it says: > > [ 33%] Built target X > make[4]: *** No rule to make target 'X.dll.a', needed by 'X.exe'. Stop. > CMakeFiles/Makefile2:1140: recipe for target 'tools/CMakeFiles/X/all' failed > > I don't know how to fix this, but I'm not completely sure that it's not > my project that instructs CMake to do this (how would I know?). > > If not, is there a way to make CMake link directly against the .dll? > > /Thomas > Cygwin64 on Windows 10 with CMake 3.3.2 > > This seems to be caused by the fact that clang command line for building shared libraries does not receive the "-Wl,--enable-auto-import" option, which gcc does. For GCC this seems to happen in Modules/Platform/CYGWIN-GNU.cmake:53, but I can't figure out where this should be placed to fix it for clang. Any pointers? /Thomas From kristianonline28 at gmail.com Mon Apr 4 04:33:04 2016 From: kristianonline28 at gmail.com (Kristian) Date: Mon, 4 Apr 2016 10:33:04 +0200 Subject: [CMake] VERSION and SOVERSION in a module Message-ID: Hey, I have a question. I have a project, which is compiled on two different build machines with ninja (trunk and branch). The CMakeLists.txt is the same when it comes to a part, where the VERSION and SOVERSION part is set through the function 'set_target_properties'. But on the first build machines, setting the VERSION and SOVERSION works, on the other machine it does not work. On the second machine (where the build fails), I recently upgraded CMake to 3.5 (I compiled and installed it on my own). The first build machine has CMake with version 2.8.11 (installed from local package manager yum). I've tried some things till I got a minimum example, where I could reproduce the error. The problem is calling add_library with MODULE. So, first the CMakeLists.txt ===== cmake_minimum_required(VERSION 2.8) project(test1) set(SOURCES func.cpp) set(VER1 "1") set(VER2 "2") set(VER3 "3") add_library(${PROJECT_NAME} MODULE ${SOURCES}) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS -Wl,-Bsymbolic VERSION ${VER1}.${VER2}.${VER3} SOVERSION 0) ===== When running this script with the commands on the first build machine (CMake 2.8.11 / this is also reproducable with Unix Makefiles generator) > cmake . && make && ls then I get this > CMakeCache.txt > cmake_install.cmake > func.cpp > libtest1.so.0 > Makefile > CMakeFiles > CMakeLists.txt > libtest1.so > libtest1.so.1.2.3 (which seems ok to me) But running the same CMakeLists.txt on the second build machine (CMake 3.5), then I get this: > CMakeCache.txt > CMakeFiles > cmake_install.cmake > CMakeLists.txt > func.cpp > libtest1.so > Makefile Is this an error? Or what should I add to the CMakeLists.txt on the second build machine, to get the same output (i.e. libtest1.so.0 libtest1.so.1.2.3)? From nilsgladitz at gmail.com Mon Apr 4 06:07:59 2016 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 4 Apr 2016 12:07:59 +0200 Subject: [CMake] VERSION and SOVERSION in a module In-Reply-To: References: Message-ID: <57023CFF.9040503@gmail.com> On 04/04/2016 10:33 AM, Kristian wrote: > Hey, > > I have a question. I have a project, which is compiled on two > different build machines with ninja (trunk and branch). The > CMakeLists.txt is the same when it comes to a part, where the VERSION > and SOVERSION part is set through the function > 'set_target_properties'. > > But on the first build machines, setting the VERSION and SOVERSION > works, on the other machine it does not work. On the second machine > (where the build fails), I recently upgraded CMake to 3.5 (I compiled > and installed it on my own). The first build machine has CMake with > version 2.8.11 (installed from local package manager yum). > > I've tried some things till I got a minimum example, where I could > reproduce the error. The problem is calling add_library with MODULE. > This behavior was deliberately changed by: https://cmake.org/gitweb?p=cmake.git;a=commit;h=f799ffb5cb895855ac2aba54765622b81db5be38 Which is in CMake since ~3.4.0. The change is related to this issue: https://cmake.org/Bug/view.php?id=15705 Nils From kristianonline28 at gmail.com Mon Apr 4 09:59:50 2016 From: kristianonline28 at gmail.com (Kristian) Date: Mon, 4 Apr 2016 15:59:50 +0200 Subject: [CMake] VERSION and SOVERSION in a module In-Reply-To: <57023CFF.9040503@gmail.com> References: <57023CFF.9040503@gmail.com> Message-ID: Thank you for your answer. It helped me a lot. 2016-04-04 12:07 GMT+02:00 Nils Gladitz : > On 04/04/2016 10:33 AM, Kristian wrote: >> >> Hey, >> >> I have a question. I have a project, which is compiled on two >> different build machines with ninja (trunk and branch). The >> CMakeLists.txt is the same when it comes to a part, where the VERSION >> and SOVERSION part is set through the function >> 'set_target_properties'. >> >> But on the first build machines, setting the VERSION and SOVERSION >> works, on the other machine it does not work. On the second machine >> (where the build fails), I recently upgraded CMake to 3.5 (I compiled >> and installed it on my own). The first build machine has CMake with >> version 2.8.11 (installed from local package manager yum). >> >> I've tried some things till I got a minimum example, where I could >> reproduce the error. The problem is calling add_library with MODULE. >> > > This behavior was deliberately changed by: > https://cmake.org/gitweb?p=cmake.git;a=commit;h=f799ffb5cb895855ac2aba54765622b81db5be38 > > Which is in CMake since ~3.4.0. > > The change is related to this issue: > https://cmake.org/Bug/view.php?id=15705 > > Nils From edisongustavo at gmail.com Mon Apr 4 10:25:36 2016 From: edisongustavo at gmail.com (Edison Gustavo Muenz) Date: Mon, 4 Apr 2016 11:25:36 -0300 Subject: [CMake] Problem calling find_package(PythonLibs) consecutively on Windows with python debug Message-ID: Hi all, The problem I?m compiling a project in which I have: - python bindings for C++ - VTK When issuing a find_package(VTK) inside a FindMyLib.cmake I got this error: CMake Error at D:/Work/Miniconda/envs/sci20/Library/share/cmake-3.4/Modules/FindPythonLibs.cmake:180 (get_filename_component): get_filename_component unknown component D:/Work/Miniconda/envs/sci20/libs/python27.lib Call Stack (most recent call first): CMakeLists.txt:15 (find_package) CMake Error at D:/Work/Miniconda/envs/sci20/Library/share/cmake-3.4/Modules/FindPythonLibs.cmake:181 (get_filename_component): get_filename_component called with incorrect number of arguments Call Stack (most recent call first): CMakeLists.txt:15 (find_package) I pinpointed the problem to: find_package(PythonInterp) find_package(PythonLibs) find_package(PythonLibs) # This call crashes Minimum reproducible example # CMakeLists.txt cmake_minimum_required(VERSION 3.4.3) project(my_project LANGUAGES CXX) message("----------------------------------------------------------------------------") message("1st Find Python (${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE})") message("-------") find_package (PythonInterp REQUIRED) find_package (PythonLibs REQUIRED) message("----------------------------------------------------------------------------") message("2nd Find Python (${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE})") message("-------") find_package (PythonLibs REQUIRED) Gives the output: ? rm -rf * && cmake -G "Ninja" x:\etk\sci20 -- The CXX compiler identification is MSVC 16.0.40219.1 -- Check for working CXX compiler using: Ninja -- Check for working CXX compiler using: Ninja -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done ----------------------------------------------------------------------------1st Find Python (X:/etk/sci20/CMakeLists.txt:6) ------- -- Found PythonInterp: D:/Work/Miniconda/envs/sci20/python.exe (found version "2.7.11") -- Found PythonLibs: optimized;D:/Work/Miniconda/envs/sci20/libs/python27.lib;debug;D:/Work/Miniconda/envs/sci20/libs/python27_d.lib (found version "2.7.11") ----------------------------------------------------------------------------2nd Find Python (X:/etk/sci20/CMakeLists.txt:12) ------- CMake Error at D:/Work/Miniconda/envs/sci20/Library/share/cmake-3.4/Modules/FindPythonLibs.cmake:180 (get_filename_component): get_filename_component unknown component D:/Work/Miniconda/envs/sci20/libs/python27.lib Call Stack (most recent call first): CMakeLists.txt:15 (find_package) CMake Error at D:/Work/Miniconda/envs/sci20/Library/share/cmake-3.4/Modules/FindPythonLibs.cmake:181 (get_filename_component): get_filename_component called with incorrect number of arguments Call Stack (most recent call first): CMakeLists.txt:15 (find_package) -- Found PythonLibs: optimized;optimized;optimized;D:/Work/Miniconda/envs/sci20/libs/python27.lib;optimized;debug;optimized;D:/Work/Miniconda/envs/sci20/libs/python27_d.lib;debug;D:/Work/Miniconda/envs/sci20/libs/python27_d.lib (found version "2.7.11") -- Configuring incomplete, errors occurred! See also "X:/etk/sci20/build/ninja/CMakeFiles/CMakeOutput.log". My environment: - Windows 7 - CMake 3.4.3 and CMake 3.5 (both showed the problem) - Python 2.7 compiled in PYDEBUG mode (python_d) Diagnosis and workaround The problem is that the PYTHON_LIBRARY variable at the 2nd call to find_package(PythonLibs) is filled with: optimized;D:/Work/Miniconda/envs/sci20/libs/python27.lib;debug;D:/Work/Miniconda/envs/sci20/libs/python27_d.lib Which makes PythonBindings.cmake confused about what to do. workaround Call unset(PYTHON_LIBRARY) before any call to find_package(PythonLibs). ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ewmailing at gmail.com Mon Apr 4 19:36:10 2016 From: ewmailing at gmail.com (Eric Wing) Date: Mon, 4 Apr 2016 16:36:10 -0700 Subject: [CMake] How to deal with generated source files (w/ dependency tracking) for globs Message-ID: Hi, this is kind of a side problem that was asked of me. I'm not sure how many hoops I actually want to jump through to solve this. But, here's the situation. I have a really nice, traditional C based project in CMake. All my dependency tracking works really well for cross-platform and IDE integration and even have resources/bundling/codesigning working nicely in the single build step. Now somebody throws me a curve ball and wants to use the Nim language. The specifics of the Nim language itself is not that important to this topic, but the key piece of information is that the Nim compiler can generate C files as output. So the question is, how can I invoke Nim to compile a list of pre-known Nim source files, and then slurp in the generated output C files and build them as part of my normal CMake build process. The curve ball is this: I don't know all the names or how many files the Nim compiler generates. If I know all the names beforehand, I think I know how to deal with this situation. But instead, I get a directory of C files. The names seem to be dependent on which library features were used and also what the user's source files were named. I suspect the standard library could theoretically change too so future versions of Nim may have different files. I know file globs with CMake don't auto-track changes and I think the problem gets more trickier because of the indirection to invoke Nim. (i.e. When I first glob the files, the directory is empty, then the Nim compiler is invoked later and the files appear, but it is too late for CMake to see without a regeneration). Anyway, I was wondering what the best approach is. Thanks, Eric From nicholas11braden at gmail.com Mon Apr 4 22:27:59 2016 From: nicholas11braden at gmail.com (Nicholas Braden) Date: Mon, 4 Apr 2016 21:27:59 -0500 Subject: [CMake] How to deal with generated source files (w/ dependency tracking) for globs In-Reply-To: References: Message-ID: I haven't tested this myself, but instead of using a glob, you could have a build step that generates a CMake script file with the list of generated files in it (e.g. via execute_process to run another CMake script whose only job is to generate the CMake script inception-style) and just include the generated file - CMake will see that the CMake file has been modified during every build but will still handle source file changes correctly. Worth a shot. On Mon, Apr 4, 2016 at 6:36 PM, Eric Wing wrote: > Hi, this is kind of a side problem that was asked of me. I'm not sure > how many hoops I actually want to jump through to solve this. But, > here's the situation. > > I have a really nice, traditional C based project in CMake. All my > dependency tracking works really well for cross-platform and IDE > integration and even have resources/bundling/codesigning working > nicely in the single build step. > > Now somebody throws me a curve ball and wants to use the Nim language. > The specifics of the Nim language itself is not that important to this > topic, but the key piece of information is that the Nim compiler can > generate C files as output. > > So the question is, how can I invoke Nim to compile a list of > pre-known Nim source files, and then slurp in the generated output C > files and build them as part of my normal CMake build process. > > The curve ball is this: I don't know all the names or how many files > the Nim compiler generates. If I know all the names beforehand, I > think I know how to deal with this situation. But instead, I get a > directory of C files. The names seem to be dependent on which library > features were used and also what the user's source files were named. I > suspect the standard library could theoretically change too so future > versions of Nim may have different files. > > I know file globs with CMake don't auto-track changes and I think the > problem gets more trickier because of the indirection to invoke Nim. > (i.e. When I first glob the files, the directory is empty, then the > Nim compiler is invoked later and the files appear, but it is too late > for CMake to see without a regeneration). > > Anyway, I was wondering what the best approach is. > > Thanks, > Eric > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake From clinton at elemtech.com Mon Apr 4 21:12:11 2016 From: clinton at elemtech.com (clinton at elemtech.com) Date: Mon, 4 Apr 2016 19:12:11 -0600 (MDT) Subject: [CMake] CPack and PackageMaker In-Reply-To: <9A894BB6-8BC9-4092-8052-B83C022EB97D@gmx.at> References: <000f4242.47dd4f8b0abb6704@dirac.se> <9A894BB6-8BC9-4092-8052-B83C022EB97D@gmx.at> Message-ID: <756640448.85837370.1459818731796.JavaMail.zimbra@elemtech.com> Hi, I have updated the patch I sent before and you can find some new code here: https://github.com/clintonstimpson/CMake/commits/productbuild To help, perhaps you can review and test it. Or help in other ways you think it needs. I have done minimal testing. This includes making sure CMake's test suite passes with this generator. And running those generated pkg files manually to test them. Perhaps after a couple reviews, we can start thinking about merging into CMake. Thanks, Clint ----- On Dec 21, 2015, at 11:56 PM, Roman W?ger wrote: > Is there anything I can do to support? > Best regards > Am 11.12.2015 um 20:17 schrieb robert.bielik < robert.bielik at dirac.se >: >> Dear Clint, >> Thank you! Will certainly start with that as a base :) >> Regards >> /R >> ------ Ursprungligt meddelande------ >> Fr?n: >> Datum: fre, 11 dec 2015 20:12 >> Till: Robert Bielik; >> Kopia: Attila Krasznahorkay;cmake; >> ?mne: Re: [CMake] CPack and PackageMaker >> If you are interested, attached is some code I started a couple years ago but >> never finished, nor did I do much testing. >> Perhaps that'll help, or maybe you'll find a better way. >> Clint >> ----- On Dec 11, 2015, at 9:50 AM, Robert Bielik robert.bielik at dirac.se wrote: >> > Dear Attila, >> > Ok, been struggling getting an installation package to work with the >> > pkgbuild/productbild tools, so I think I got the gist of what needs to >> > be done, at least to get something going :) >> > Regards >> > /R >> > Den 2015-12-11 kl. 17:47, skrev Attila Krasznahorkay: >> >> Hi Robert, >> >> I'm afraid that the sad situation is that nobody has done this yet, or is >> >> working on it at the moment. >> >> I'm absolutely sure that if you can help with this by any amount, that will be >> >> most welcome by the CMake developers. It will certainly be most welcome by me, >> >> as I've been disappointed by the lack of this support as well. (But >> >> unfortunately can't spare the time to help out in writing this CPack >> >> generator.) >> >> Cheers, >> >> ??????????????Attila >> >>> On 11 Dec 2015, at 17:44, Robert Bielik? wrote: >> >>> Really ? No one ? :) >> >>> So it's ok to go ahead and start create a new one ? ;) >> >>> Rgds, >> >>> /R >> >>> Den 2015-12-09 kl. 16:56, skrev Robert Bielik: >> >>>> Mac OSX: >> >>>> Since PackageMaker has been deprecated by Apple, the new tools to use are >> >>>> pkgbuild [1] and productbuild [2]. >> >>>> Simple question: Is there any work being done by the CMake community on a new OS >> >>>> X CPack backend to support the above tools ? >> >>>> Regards >> >>>> /Robert >> >>>> [1] >>>>>> https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/pkgbuild.1.html >> >>>> >>>> [2] >>>>>> https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/productbuild.1.html >> >>>> >>>> >> >>> -- >> >>> 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 >> -- >> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.krasznahorkay at gmail.com Tue Apr 5 04:32:35 2016 From: attila.krasznahorkay at gmail.com (Attila Krasznahorkay) Date: Tue, 5 Apr 2016 10:32:35 +0200 Subject: [CMake] Check the existence of a header / ability to compile source file Message-ID: <0E6CA50D-E9E8-4932-A5B1-ABF17ACCB776@gmail.com> Dear All, I'm stumped on the following, seemingly simple issue. I need to figure out in my configuration whether a given header file will be available when I'll try to build my library, or not. So that I could set a particular definition for the compiler according to whether the file is available or not. The complication is that I use generator expressions very heavily in setting up the compilation flags of the library in question. So at configuration time I don't even know yet all the include directories that I should be looking in to find that header. That only becomes known after the generation step. But as far as I can tell, check_include_files(...) can only run during the configuration step. So relying on generator expressions in setting up its include directories is not an option. Is there any other possibility of making such a check, during the generation step? Or is there some other mechanism that I could use to do this check during the build itself? (After all, it could be a solution to generate a configuration header with this information during the build itself...) Cheers, Attila From Mateju.Miroslav at azd.cz Tue Apr 5 04:36:10 2016 From: Mateju.Miroslav at azd.cz (=?utf-8?B?TWF0xJtqxa8gTWlyb3NsYXYsIEluZy4=?=) Date: Tue, 5 Apr 2016 08:36:10 +0000 Subject: [CMake] Parsing command line arguments from the make In-Reply-To: References: Message-ID: <35564eb9ad3e44499c9f4686af6553b9@azdexchstore3.AZD.LOCAL> Hi Fedja, As far as I know, the Makefiles generated from CMake cannot contain decisions. CMake supports several output types aside from Makefiles and some of them probably don?t support decisions. However, you could supply these arguments within CMake call using -D option. For example cmake -DENV=VERSION_2 creates a CMake variable just like set(ENV "VERSION_2" CACHE) in the CMake source file. As you?ve mentioned already, you can access environment variables using $ENV{variable} syntax in CMake. Hope this helps. Miroslav From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Fedja Jeleskovic Sent: Friday, April 01, 2016 8:08 PM To: cmake at cmake.org Subject: [CMake] Parsing command line arguments from the make Since I am converting existing makefile project to use cmake instead I need to accept values that come from command line which looks like this: VARIABLE_NAME="/home/user/project" make ENV=VERSION_2 First one is used like this: include $(VARIABLE_NAME)/Makefile.include Second one has this code that triggers different paths later: ifneq ($(ENV),) DEPLOYMENT_VERSION=$(ENV) endif How do I do this in cmake? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrawd2 at gmail.com Tue Apr 5 15:24:47 2016 From: mrawd2 at gmail.com (Fedja Jeleskovic) Date: Tue, 5 Apr 2016 15:24:47 -0400 Subject: [CMake] Parsing command line arguments from the make In-Reply-To: <35564eb9ad3e44499c9f4686af6553b9@azdexchstore3.AZD.LOCAL> References: <35564eb9ad3e44499c9f4686af6553b9@azdexchstore3.AZD.LOCAL> Message-ID: I ended up using this exact approach with addition of one top level Makefile which is used to run cmake in build folder. Top level Makefile takes those arguments and passes them down to the cmake execution, which than makes a decision on which way to go depending on the argument passed in. Here is how that part looks like: BUILD_DIR := build ifneq ($(ENV),) DEPLOY=$(ENV) endif ifeq "$(DEPLOY)" "V1" NEW_FLAG=-DVERSION_1=ON else ifeq "$(DEPLOY)" "V2" NEW_FLAG = -DVERSION_2=ON else ifeq "$(DEPLOY)" "V3" NEW_FLAG = -DVERSION_3=ON endif endif endif all: ${BUILD_DIR}/Makefile $(MAKE) -C ${BUILD_DIR} cmake: touch CMakeLists.txt $(MAKE) ${BUILD_DIR}/Makefile ${BUILD_DIR}/Makefile: @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR} @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake $(NEW_FLAG) ..) touch $@ I have also created three options (needed three in my case) that create #defines for each of them and depending on which is initialized at the start, ends up being enabled in the source code. The issue that I had at the end was to clean cached values of those since regular clean wasn't clearing #define that was previously set. At the end I am running "make clean" in build folder, following with delete of build/CMakeCache.txt and build/Makefile. After that new option passed in to the top level Makefile does what I need (initialize proper #define that is). Here is how the clean section looks like in the top level Makefile: .PHONY : clean clean: @- [ -f ${BUILD_DIR}/Makefile ] && $(MAKE) --silent -C ${BUILD_DIR} clean || true @- [ -f ${BUILD_DIR}/CMakeCache.txt ] && rm ${BUILD_DIR}/CMakeCache.txt || true @- [ -f ${BUILD_DIR}/Makefile ] && rm -rf ${BUILD_DIR}/Makefile || true If there is a better way to clear the cache so I don't have to delete those two files, I would like someone to point it. Thanks for help and hope this will be useful for someone else in the future! Any other comments on this are welcome! On Tue, Apr 5, 2016 at 4:36 AM, Mat?j? Miroslav, Ing. < Mateju.Miroslav at azd.cz> wrote: > Hi Fedja, > > > > As far as I know, the Makefiles generated from CMake cannot contain > decisions. CMake supports several output types aside from Makefiles and > some of them probably don?t support decisions. However, you could supply > these arguments within CMake call using -D option. For example > > cmake -DENV=VERSION_2 > > creates a CMake variable just like > > set(ENV "VERSION_2" CACHE) > > in the CMake source file. > > > > As you?ve mentioned already, you can access environment variables using > $ENV{variable} syntax in CMake. > > > > Hope this helps. > > > > Miroslav > > > > *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Fedja > Jeleskovic > *Sent:* Friday, April 01, 2016 8:08 PM > *To:* cmake at cmake.org > *Subject:* [CMake] Parsing command line arguments from the make > > > > Since I am converting existing makefile project to use cmake instead I > need to accept values that come from command line which looks like this: > VARIABLE_NAME="/home/user/project" make ENV=VERSION_2 > > > > First one is used like this: > > include $(VARIABLE_NAME)/Makefile.include > > > > Second one has this code that triggers different paths later: > ifneq ($(ENV),) > > DEPLOYMENT_VERSION=$(ENV) > > endif > > > > How do I do this in cmake? > > > > Thanks! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From salazardetro1 at llnl.gov Tue Apr 5 15:55:59 2016 From: salazardetro1 at llnl.gov (Salazar De Troya, Miguel) Date: Tue, 5 Apr 2016 19:55:59 +0000 Subject: [CMake] Finding all the libraries except for one located in the last path dir Message-ID: Hello I am calling find_library in a loop, using the same variable for HINTS. This variable (lib_dirs) is set using a script, and when I simply print it using message(), I obtain this output: message(${lib_dirs}) /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib The variable lib_dirs is the output variable of a script that I call using execute_process(). The actual script output (in the terminal) is /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; but cmakes removes all the semicolons and puts them all together, why? Now when I call find_library() for several libraries, I can find them all except the one located in /g/g92/miguel/code/libmesh_2D/lib, why? Thanks Miguel -------------- next part -------------- An HTML attachment was scrubbed... URL: From salazardetro1 at llnl.gov Tue Apr 5 16:57:00 2016 From: salazardetro1 at llnl.gov (Salazar De Troya, Miguel) Date: Tue, 5 Apr 2016 20:57:00 +0000 Subject: [CMake] Finding all the libraries except for one located in the last path dir Message-ID: My apologies, the previous error was because of a trailing whitespace. Although I would still like to know why the terminal variable /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; is transformed into /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib Miguel From: CMake > on behalf of Miguel Salazar > Date: Tuesday, April 5, 2016 at 12:55 PM To: "cmake at cmake.org" > Subject: [CMake] Finding all the libraries except for one located in the last path dir Hello I am calling find_library in a loop, using the same variable for HINTS. This variable (lib_dirs) is set using a script, and when I simply print it using message(), I obtain this output: message(${lib_dirs}) /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib The variable lib_dirs is the output variable of a script that I call using execute_process(). The actual script output (in the terminal) is /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; but cmakes removes all the semicolons and puts them all together, why? Now when I call find_library() for several libraries, I can find them all except the one located in /g/g92/miguel/code/libmesh_2D/lib, why? Thanks Miguel -------------- next part -------------- An HTML attachment was scrubbed... URL: From salazardetro1 at llnl.gov Tue Apr 5 17:31:49 2016 From: salazardetro1 at llnl.gov (Salazar De Troya, Miguel) Date: Tue, 5 Apr 2016 21:31:49 +0000 Subject: [CMake] Finding all the libraries except for one located in the last path dir In-Reply-To: References: Message-ID: Sorry for the spam, but I found out that there is a line break added by CMake execute_process(COMMAND bash "../grab_libraries.sh" "lib_dirs" "${METHOD}" OUTPUT_VARIABLE lib_dirs) grab_libraries.sh is located in the same folder than CMakeLists.txt and I call cmake .. from a build folder inside the same folder than CMakeLists.txt . The output for the script ./grab_libraries.sh is: /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; with no line break, whereas the output variable lib_dirs: message(${lib_dirs}) /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib does have a line break and also the semicolons are removed. What?s happening here and how can I get rid of that? Thanks Miguel From: Miguel Salazar > Date: Tuesday, April 5, 2016 at 1:57 PM To: Miguel Salazar >, "cmake at cmake.org" > Subject: Re: [CMake] Finding all the libraries except for one located in the last path dir My apologies, the previous error was because of a trailing whitespace. Although I would still like to know why the terminal variable /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; is transformed into /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib Miguel From: CMake > on behalf of Miguel Salazar > Date: Tuesday, April 5, 2016 at 12:55 PM To: "cmake at cmake.org" > Subject: [CMake] Finding all the libraries except for one located in the last path dir Hello I am calling find_library in a loop, using the same variable for HINTS. This variable (lib_dirs) is set using a script, and when I simply print it using message(), I obtain this output: message(${lib_dirs}) /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib The variable lib_dirs is the output variable of a script that I call using execute_process(). The actual script output (in the terminal) is /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; but cmakes removes all the semicolons and puts them all together, why? Now when I call find_library() for several libraries, I can find them all except the one located in /g/g92/miguel/code/libmesh_2D/lib, why? Thanks Miguel -------------- next part -------------- An HTML attachment was scrubbed... URL: From salazardetro1 at llnl.gov Tue Apr 5 17:37:34 2016 From: salazardetro1 at llnl.gov (Salazar De Troya, Miguel) Date: Tue, 5 Apr 2016 21:37:34 +0000 Subject: [CMake] Finding all the libraries except for one located in the last path dir In-Reply-To: References: Message-ID: I resolved this using the option OUTPUT_STRIP_TRAILING_WHITESPACE in execute_process(). https://cmake.org/cmake/help/v3.0/command/execute_process.html I had not seen it. From: Miguel Salazar > Date: Tuesday, April 5, 2016 at 2:31 PM To: Miguel Salazar >, "cmake at cmake.org" > Subject: Re: [CMake] Finding all the libraries except for one located in the last path dir Sorry for the spam, but I found out that there is a line break added by CMake execute_process(COMMAND bash "../grab_libraries.sh" "lib_dirs" "${METHOD}" OUTPUT_VARIABLE lib_dirs) grab_libraries.sh is located in the same folder than CMakeLists.txt and I call cmake .. from a build folder inside the same folder than CMakeLists.txt . The output for the script ./grab_libraries.sh is: /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; with no line break, whereas the output variable lib_dirs: message(${lib_dirs}) /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib does have a line break and also the semicolons are removed. What?s happening here and how can I get rid of that? Thanks Miguel From: Miguel Salazar > Date: Tuesday, April 5, 2016 at 1:57 PM To: Miguel Salazar >, "cmake at cmake.org" > Subject: Re: [CMake] Finding all the libraries except for one located in the last path dir My apologies, the previous error was because of a trailing whitespace. Although I would still like to know why the terminal variable /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; is transformed into /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib Miguel From: CMake > on behalf of Miguel Salazar > Date: Tuesday, April 5, 2016 at 12:55 PM To: "cmake at cmake.org" > Subject: [CMake] Finding all the libraries except for one located in the last path dir Hello I am calling find_library in a loop, using the same variable for HINTS. This variable (lib_dirs) is set using a script, and when I simply print it using message(), I obtain this output: message(${lib_dirs}) /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib The variable lib_dirs is the output variable of a script that I call using execute_process(). The actual script output (in the terminal) is /usr/lib;/lib;/usr/lib64;/usr/local/tools/vtk-6.1.0/lib;/g/g92/miguel/petsc-3.6.2/miguel-opt/lib;/usr/local/tools/openmpi-intel-1.8.4/lib;/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64;/usr/lib/gcc/x86_64-redhat-linux/4.4.7;/g/g92/miguel/code/libmesh_2D/lib; but cmakes removes all the semicolons and puts them all together, why? Now when I call find_library() for several libraries, I can find them all except the one located in /g/g92/miguel/code/libmesh_2D/lib, why? Thanks Miguel -------------- next part -------------- An HTML attachment was scrubbed... URL: From nilsgladitz at gmail.com Tue Apr 5 17:44:55 2016 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Tue, 5 Apr 2016 23:44:55 +0200 Subject: [CMake] Finding all the libraries except for one located in the last path dir In-Reply-To: References: Message-ID: <570431D7.1020503@gmail.com> On 05.04.2016 23:31, Salazar De Troya, Miguel wrote: > > > with no line break, whereas the output variable lib_dirs: > > message(${lib_dirs}) > > > /usr/lib/lib/usr/lib64/usr/local/tools/vtk-6.1.0/lib/g/g92/miguel/petsc-3.6.2/miguel-opt/lib/usr/local/tools/openmpi-intel-1.8.4/lib/usr/local/tools/ic-14.0.174/composer_xe_2013_sp1.3.174/compiler/lib/intel64/usr/lib/gcc/x86_64-redhat-linux/4.4.7/g/g92/miguel/code/libmesh_2D/lib > > > does have a line break and also the semicolons are removed. What?s > happening here and how can I get rid of that? > message() concatenates its (semicolon separated) arguments. try: message("${lib_dirs}") Note the quotes. Nils -------------- next part -------------- An HTML attachment was scrubbed... URL: From sstallion at gmail.com Wed Apr 6 00:18:41 2016 From: sstallion at gmail.com (Steven Stallion) Date: Tue, 5 Apr 2016 23:18:41 -0500 Subject: [CMake] Performance issues on very large project Message-ID: All, I am currently working on a very large project that contains over 500 (yes, really) listfiles. A co-worker was looking into some performance issues we were seeing during configuration and found something very interesting. Currently configuration is taking 1m57s across several configurations using Mac OS X as a host and the latest .dmg from cmake.org (3.5.1). We have a core module that provides a number of helper functions and macros (completely stateless) that is included by most of this listfiles (nearly 400 of them). We found that an include guard was missing, after adding that configuration now clocks in at 1m30s. Taking things a step further, we removed includes of the module, and simply included it once in the top-level listfile. Configuration then dropped to about 55s. The results above seem to indicate a possible file I/O bottleneck. This is very surprising to me - these builds are being run on recent core-i7's with SSDs. Is anyone else on the list dealing with large projects or similar configuration issues? TIA, Steve From patrick.boettcher at posteo.de Wed Apr 6 02:54:00 2016 From: patrick.boettcher at posteo.de (Patrick Boettcher) Date: Wed, 6 Apr 2016 08:54:00 +0200 Subject: [CMake] Performance issues on very large project In-Reply-To: References: Message-ID: <20160406085400.08bce25e@posteo.de> Hi, On Tue, 5 Apr 2016 23:18:41 -0500 Steven Stallion wrote: > All, > > I am currently working on a very large project that contains over 500 > (yes, really) listfiles. A co-worker was looking into some performance > issues we were seeing during configuration and found something very > interesting. Currently configuration is taking 1m57s across several > configurations using Mac OS X as a host and the latest .dmg from > cmake.org (3.5.1). > > We have a core module that provides a number of helper functions and > macros (completely stateless) that is included by most of this > listfiles (nearly 400 of them). We found that an include guard was > missing, after adding that configuration now clocks in at 1m30s. > > Taking things a step further, we removed includes of the module, and > simply included it once in the top-level listfile. Configuration then > dropped to about 55s. > > The results above seem to indicate a possible file I/O bottleneck. > This is very surprising to me - these builds are being run on recent > core-i7's with SSDs. Is anyone else on the list dealing with large > projects or similar configuration issues? LLVM/Clang is using ~330 CMakeLists.txt - I never noticed the config-step to be a bottleneck (cmake ../llvm takes 10 seconds on my system). But LLVM/Clang is not including a lot of Modules. real 0m10.551s user 0m6.696s sys 0m1.576s Maybe it is more a question of LOC of than the number of files. regards, -- Patrick. From realnc at gmail.com Wed Apr 6 07:22:17 2016 From: realnc at gmail.com (Nikos Chantziaras) Date: Wed, 6 Apr 2016 14:22:17 +0300 Subject: [CMake] Portability of preprocessor defines Message-ID: Hello. It seems that everyone defines their preprocessor symbols like this: -DFOO I actually prefer this: -D FOO (With a space.) Is this just as portable as the version without the space though? Would CMake remove the space if needed, and if not, would that ever cause issues? From ewmailing at gmail.com Wed Apr 6 07:28:51 2016 From: ewmailing at gmail.com (Eric Wing) Date: Wed, 6 Apr 2016 04:28:51 -0700 Subject: [CMake] How to deal with generated source files (w/ dependency tracking) for globs In-Reply-To: References: Message-ID: On 4/4/16, Nicholas Braden wrote: > I haven't tested this myself, but instead of using a glob, you could > have a build step that generates a CMake script file with the list of > generated files in it (e.g. via execute_process to run another CMake > script whose only job is to generate the CMake script inception-style) > and just include the generated file - CMake will see that the CMake > file has been modified during every build but will still handle source > file changes correctly. Worth a shot. > Thanks for the reply. So if I understand this correctly, this is what the workflow is going to feel like. - User adds their Nim file to the CMakeLists.txt - CMake detects a change and a bootstrap generate/update takes place, and my stuff re-runs the Nim compiler. - Also during this phase, I need to generate another CMake script which contains the list of files the Nim compiler output. - Since this other script is also under CMake change tracking, this will trigger another CMake change detection and bootstrap/generate/update. - Now the generated build system has the updated list of generated .c files to compile and will finally compile it. Does this sound right? My major concern is that the two bootstrap phases kind of break the flow. What I mean by that is that in Xcode for example, when a bootstrap/generate/update happens, it actually causes your Build/Run (run button) action to abort midway through. You sit there expecting it to build, but CMake's regeneration was the only thing that happened. You must hit the Run button again to actually build/run. Kind of annoying and also really confusing for people who don't understand this because it isn't obvious why this happened. But in the above example, there are now two bootstrap phases. So assuming this works, I think the user will have to hit the Run button at least 3 times before something actually builds/runs. I think this is going to feel real broken and feel like dumb luck something actually built. So I was hoping to find a one-step bootstrap solution instead of two-step. Thanks, Eric From nicholas11braden at gmail.com Wed Apr 6 09:55:22 2016 From: nicholas11braden at gmail.com (Nicholas Braden) Date: Wed, 6 Apr 2016 08:55:22 -0500 Subject: [CMake] How to deal with generated source files (w/ dependency tracking) for globs In-Reply-To: References: Message-ID: Okay, so I tried my own suggesting and found that it doesn't work at all (it's more complicated than I thought). However I want to ask you about your logic here - you say that when the configure step runs, it cancels XCode's build and so the user has to run the build a second time. If we use a script to generate a file or just touch one of the cmake files for every build, that means that every build will be cancelled and XCode will never move on to actually compile anything. The only way to actually let a build not be cancelled is either to run `cmake --build .` from the command line instead of using the IDE, or to not modify any CMake file, which requires some pretty elaborate scripting to accomplish. Even just touching the modified date of a CMake file will cause the configure step to run. At this point I think you should just tell your users to manually run the configure step whenever they add or remove a nim source file, because either way it will be a two-click process. There is no way I see to have the magic single-click build you want given XCode's limitations. But if you ever do find a way I'd be interested to hear. (Though, I don't know how XCode treats External Projects - maybe you could get it to work that way, but it'd be ugly) On Wed, Apr 6, 2016 at 6:28 AM, Eric Wing wrote: > On 4/4/16, Nicholas Braden wrote: >> I haven't tested this myself, but instead of using a glob, you could >> have a build step that generates a CMake script file with the list of >> generated files in it (e.g. via execute_process to run another CMake >> script whose only job is to generate the CMake script inception-style) >> and just include the generated file - CMake will see that the CMake >> file has been modified during every build but will still handle source >> file changes correctly. Worth a shot. >> > > Thanks for the reply. So if I understand this correctly, this is what > the workflow is going to feel like. > > - User adds their Nim file to the CMakeLists.txt > - CMake detects a change and a bootstrap generate/update takes place, > and my stuff re-runs the Nim compiler. > - Also during this phase, I need to generate another CMake script > which contains the list of files the Nim compiler output. > - Since this other script is also under CMake change tracking, this > will trigger another CMake change detection and > bootstrap/generate/update. > - Now the generated build system has the updated list of generated .c > files to compile and will finally compile it. > > Does this sound right? > > My major concern is that the two bootstrap phases kind of break the > flow. What I mean by that is that in Xcode for example, when a > bootstrap/generate/update happens, it actually causes your Build/Run > (run button) action to abort midway through. You sit there expecting > it to build, but CMake's regeneration was the only thing that > happened. You must hit the Run button again to actually build/run. > Kind of annoying and also really confusing for people who don't > understand this because it isn't obvious why this happened. > > But in the above example, there are now two bootstrap phases. So > assuming this works, I think the user will have to hit the Run button > at least 3 times before something actually builds/runs. I think this > is going to feel real broken and feel like dumb luck something > actually built. > > So I was hoping to find a one-step bootstrap solution instead of two-step. > > Thanks, > Eric From sstallion at gmail.com Wed Apr 6 09:59:39 2016 From: sstallion at gmail.com (Steven Stallion) Date: Wed, 6 Apr 2016 08:59:39 -0500 Subject: [CMake] Performance issues on very large project In-Reply-To: <35F6921410093E4CA40D524BD5C18D4C30DE52E1@EDXMB89.jdnet.deere.com> References: <35F6921410093E4CA40D524BD5C18D4C30DE52E1@EDXMB89.jdnet.deere.com> Message-ID: It turns out the problem was due to scoping. The module in question was only being included by subdirectories, but not the top-level listfile (I'm sure you can see where this is going). Switching the include guard to make use of a property rather than a variable took care of the problem nicely - we're back to 55s. Thanks for the responses! Steve On Wed, Apr 6, 2016 at 8:38 AM, Miller Henry wrote: > I found the same thing a few years ago, and my solution was the same: only include those modules once. I find that my sub cmake modules are much cleaner now as a bonus. > > I tend to blame the time not on file IO, but on time to parse those files. I've never done actual profiling though. > > -----Original Message----- > From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Steven Stallion > Sent: Tuesday, April 05, 2016 11:19 PM > To: cmake at cmake.org > Subject: [CMake] Performance issues on very large project > > All, > > I am currently working on a very large project that contains over 500 (yes, really) listfiles. A co-worker was looking into some performance issues we were seeing during configuration and found something very interesting. Currently configuration is taking 1m57s across several configurations using Mac OS X as a host and the latest .dmg from cmake.org (3.5.1). > > We have a core module that provides a number of helper functions and macros (completely stateless) that is included by most of this listfiles (nearly 400 of them). We found that an include guard was missing, after adding that configuration now clocks in at 1m30s. > > Taking things a step further, we removed includes of the module, and simply included it once in the top-level listfile. Configuration then dropped to about 55s. > > The results above seem to indicate a possible file I/O bottleneck. > This is very surprising to me - these builds are being run on recent core-i7's with SSDs. Is anyone else on the list dealing with large projects or similar configuration issues? > > TIA, > > Steve > -- > > 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 From MillerHenry at JohnDeere.com Wed Apr 6 09:38:59 2016 From: MillerHenry at JohnDeere.com (Miller Henry) Date: Wed, 6 Apr 2016 13:38:59 +0000 Subject: [CMake] Performance issues on very large project In-Reply-To: References: Message-ID: <35F6921410093E4CA40D524BD5C18D4C30DE52E1@EDXMB89.jdnet.deere.com> I found the same thing a few years ago, and my solution was the same: only include those modules once. I find that my sub cmake modules are much cleaner now as a bonus. I tend to blame the time not on file IO, but on time to parse those files. I've never done actual profiling though. -----Original Message----- From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Steven Stallion Sent: Tuesday, April 05, 2016 11:19 PM To: cmake at cmake.org Subject: [CMake] Performance issues on very large project All, I am currently working on a very large project that contains over 500 (yes, really) listfiles. A co-worker was looking into some performance issues we were seeing during configuration and found something very interesting. Currently configuration is taking 1m57s across several configurations using Mac OS X as a host and the latest .dmg from cmake.org (3.5.1). We have a core module that provides a number of helper functions and macros (completely stateless) that is included by most of this listfiles (nearly 400 of them). We found that an include guard was missing, after adding that configuration now clocks in at 1m30s. Taking things a step further, we removed includes of the module, and simply included it once in the top-level listfile. Configuration then dropped to about 55s. The results above seem to indicate a possible file I/O bottleneck. This is very surprising to me - these builds are being run on recent core-i7's with SSDs. Is anyone else on the list dealing with large projects or similar configuration issues? TIA, Steve -- 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 From mkeeler at tenable.com Wed Apr 6 14:32:25 2016 From: mkeeler at tenable.com (Matthew Keeler) Date: Wed, 6 Apr 2016 14:32:25 -0400 Subject: [CMake] OBJECT Libraries with Xcode Generator Message-ID: ? I think I ran into a bug but I am wondering if anyone has seen it an worked around. I have a source structure like the following (this is a contrived small example to illustrate the problem): - CMakeLists.txt - main.c - lib ? ?- CMakeLists.txt ? ?- x.c ? ?- x.h ? ?- alt1 ? ? ? - x.c ? ? ? - x.h ? ?- alt2 ? ? ? - x.c ? ? ? - x.h CMakeLists.txt: ? ?cmake_minimum_required(VERSION 3.5) ? ?project(example) ? ?add_subdirectory(lib) ? ?include_directories(lib) ? ?add_executable(main main.c $) main.c: ? ?#include "x.h" ? ? ? ?int main() ? ?{ ? ? ??return example_func(); ? ?} lib/CMakeLists.txt: ? ?option(ALT1 "ALT1" ON) ? ?option(ALT2 "ALT2" ON) ? ?set(SOURCES x.c) ? ?if ( ALT1 ) ? ? ? add_definitions(-DALT1) ? ? ? list(APPEND SOURCES alt1/x.c) ? ?elseif ( ALT2 ) ? ? ? add_definitions(-DALT2) ? ? ? list(APPEND SOURCES alt2/x.c) ? ?else () ? ? ? ?message(FATAL_ERROR "No alt defined") ? ?endif() ? ?add_library(example OBJECT ${SOURCES}) lib/x.h: ? ?#ifndef X_H ? ?#define X_H ? ?int example_func(); ? ?#endif lib/x.c: #include "x.h" #ifdef ALT2 #include "alt2/x.h" #else #include "alt1/x.h" #endif int example_func() { return call_example_func(); } lib/alt1/x.h: ? ?#ifndef ALT1_X_H ? ?#define ALT1_X_H ? ?int alt1_example_func(); ? ?#define call_example_func() alt1_example_func() ? ?#endif lib/alt1/x.c: ? ?int alt1_example_func() ? ?{ ? ? ? return 1; ? ?} lib/alt2/x.h: ? ?#ifndef ALT2_X_H ? ?#define ALT2_X_H ? ?int alt2_example_func(); ? ?#define call_example_func() alt2_example_func() ? ?#endif lib/alt2/x.c: ? ?int alt2_example_func() ? ?{ ? ? ? return 2; ? ?} Now if I run cmake using the makefile generator and then run make, all is well and everything is built and runs as expected. If I use the Xcode generator I get the following errors: clang: error: no such file or directory: ?/lib/example.build/Debug/example.build/Objects-normal/x86_64/x.o? Within the directory?/lib/example.build/Debug/example.build/Objects-normal/x86_64 there is in fact no x.o. Instead there are two files,?x-8171277E06B93FB2.o and?x-FA155118579B6D7E.o. So it looks like for the XCode generators sources intermediate object files for a single CMakeLists.txt are stored within a single directory. And in this case the sources have the same name so the x-.o names are used instead. However the $ generator expression seems to be referencing an incorrect name. Is there any workaround so that for the Xcode generator it will not store all the build artifacts in a single directory and not use the object file name with the unique id in it and secondly where is the proper place to file a bug for this. -- Matthew Keeler From gjasny at googlemail.com Wed Apr 6 15:47:23 2016 From: gjasny at googlemail.com (Gregor Jasny) Date: Wed, 6 Apr 2016 21:47:23 +0200 Subject: [CMake] OBJECT Libraries with Xcode Generator In-Reply-To: References: Message-ID: <570567CB.5030908@googlemail.com> On 06/04/16 20:32, Matthew Keeler wrote: > > I think I ran into a bug but I am wondering if anyone has seen it an worked around. > > I have a source structure like the following (this is a contrived small example to illustrate the problem): > > - CMakeLists.txt > - main.c > - lib > - CMakeLists.txt > - x.c > - x.h > - alt1 > - x.c > - x.h > - alt2 > - x.c > - x.h > > CMakeLists.txt: > > cmake_minimum_required(VERSION 3.5) > project(example) > add_subdirectory(lib) > include_directories(lib) > add_executable(main main.c $) > > > main.c: > > #include "x.h" > > int main() > { > return example_func(); > } > > lib/CMakeLists.txt: > > option(ALT1 "ALT1" ON) > option(ALT2 "ALT2" ON) > set(SOURCES x.c) > if ( ALT1 ) > add_definitions(-DALT1) > list(APPEND SOURCES alt1/x.c) > elseif ( ALT2 ) > add_definitions(-DALT2) > list(APPEND SOURCES alt2/x.c) > else () > message(FATAL_ERROR "No alt defined") > endif() > add_library(example OBJECT ${SOURCES}) > > lib/x.h: > > #ifndef X_H > #define X_H > int example_func(); > #endif > > lib/x.c: > > #include "x.h" > #ifdef ALT2 > #include "alt2/x.h" > #else > #include "alt1/x.h" > #endif > int example_func() > { > return call_example_func(); > } > > > lib/alt1/x.h: > > #ifndef ALT1_X_H > #define ALT1_X_H > int alt1_example_func(); > #define call_example_func() alt1_example_func() > #endif > > > lib/alt1/x.c: > > int alt1_example_func() > { > return 1; > } > > lib/alt2/x.h: > > #ifndef ALT2_X_H > #define ALT2_X_H > int alt2_example_func(); > #define call_example_func() alt2_example_func() > #endif > > > lib/alt2/x.c: > > int alt2_example_func() > { > return 2; > } > > > > Now if I run cmake using the makefile generator and then run make, all is well and everything is built and runs as expected. If I use the Xcode generator I get the following errors: > > clang: error: no such file or directory: ?/lib/example.build/Debug/example.build/Objects-normal/x86_64/x.o? > > Within the directory /lib/example.build/Debug/example.build/Objects-normal/x86_64 there is in fact no x.o. Instead there are two files, x-8171277E06B93FB2.o and x-FA155118579B6D7E.o. So it looks like for the XCode generators sources intermediate object files for a single CMakeLists.txt are stored within a single directory. And in this case the sources have the same name so the x-.o names are used instead. However the $ generator expression seems to be referencing an incorrect name. Is there any workaround so that for the Xcode generator it will not store all the build artifacts in a single directory and not use the object file name with the unique id in it and secondly where is the proper place to file a bug for this. Thank you for the minimal example. Please file a bug in the bug tracker. Thanks, Gregor From brad.king at kitware.com Wed Apr 6 16:06:07 2016 From: brad.king at kitware.com (Brad King) Date: Wed, 6 Apr 2016 16:06:07 -0400 Subject: [CMake] OBJECT Libraries with Xcode Generator In-Reply-To: <570567CB.5030908@googlemail.com> References: <570567CB.5030908@googlemail.com> Message-ID: <57056C2F.6010507@kitware.com> On 04/06/2016 03:47 PM, Gregor Jasny wrote: > On 06/04/16 20:32, Matthew Keeler wrote: >> clang: error: no such file or directory: >> '.../lib/example.build/Debug/example.build/Objects-normal/x86_64/x.o' >> >> Within the directory .../lib/example.build/Debug/example.build/Objects-normal/x86_64 >> there is in fact no x.o. Instead there are two files, x-8171277E06B93FB2.o and >> x-FA155118579B6D7E.o. So it looks like for the XCode generators sources intermediate >> object files for a single CMakeLists.txt are stored within a single directory. >> And in this case the sources have the same name so the x-.o names are used instead. >> However the $ generator expression seems to be referencing an >> incorrect name. Is there any workaround so that for the Xcode generator it will >> not store all the build artifacts in a single directory and not use the object >> file name with the unique id in it It is unlikely CMake will be able to predict the object file names Xcode will choose for repeated sources, so yes it would be nice to be able to tell Xcode to put the objects in separate directories. I don't know whether this is possible though. As a workaround you could either rename one source or add/generate another source with a different name that uses #include to get the original. >> and secondly where is the proper place to file a bug for this. > Thank you for the minimal example. Please file a bug in the bug tracker. https://cmake.org/Bug Thanks, -Brad From mkeeler at tenable.com Wed Apr 6 17:02:16 2016 From: mkeeler at tenable.com (Matthew Keeler) Date: Wed, 6 Apr 2016 17:02:16 -0400 Subject: [CMake] OBJECT Libraries with Xcode Generator In-Reply-To: <57056C2F.6010507@kitware.com> References: <570567CB.5030908@googlemail.com> <57056C2F.6010507@kitware.com> Message-ID: Ah, I thought cmake was controlling the output filenames of the compiler and not Xcode. Then its not really a cmake problem. Changing source names is easy enough. I was just curious. Also in the real case I could just as easily use a STATIC library instead but normally go for OBJECT libraries first. Oh well. Thanks for the info. --? Matthew Keeler On April 6, 2016 at 16:06:11, Brad King (brad.king at kitware.com) wrote: On 04/06/2016 03:47 PM, Gregor Jasny wrote: > On 06/04/16 20:32, Matthew Keeler wrote: >> clang: error: no such file or directory: >> '.../lib/example.build/Debug/example.build/Objects-normal/x86_64/x.o' >> >> Within the directory .../lib/example.build/Debug/example.build/Objects-normal/x86_64 >> there is in fact no x.o. Instead there are two files, x-8171277E06B93FB2.o and >> x-FA155118579B6D7E.o. So it looks like for the XCode generators sources intermediate >> object files for a single CMakeLists.txt are stored within a single directory. >> And in this case the sources have the same name so the x-.o names are used instead. >> However the $ generator expression seems to be referencing an >> incorrect name. Is there any workaround so that for the Xcode generator it will >> not store all the build artifacts in a single directory and not use the object >> file name with the unique id in it It is unlikely CMake will be able to predict the object file names Xcode will choose for repeated sources, so yes it would be nice to be able to tell Xcode to put the objects in separate directories. I don't know whether this is possible though. As a workaround you could either rename one source or add/generate another source with a different name that uses #include to get the original. >> and secondly where is the proper place to file a bug for this. > Thank you for the minimal example. Please file a bug in the bug tracker. https://cmake.org/Bug Thanks, -Brad -------------- next part -------------- An HTML attachment was scrubbed... URL: From kristianonline28 at gmail.com Wed Apr 6 18:50:48 2016 From: kristianonline28 at gmail.com (Kristian) Date: Thu, 7 Apr 2016 00:50:48 +0200 Subject: [CMake] CPack does not generate a RPM Message-ID: Hi, I have an error and I do not know, how to solve this error. I have an archive, where are some files. I want to generate a rpm package with the files, which are in that archive. So first, I extract that archive with a bash script. After that, the script calls "cpack -G RPM -V ." for this CMakeLists.txt: cmake_minimum_required(VERSION 3.5) project(project1) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/usr/bin/calculator DESTINATION bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/usr/lib64/* DESTINATION lib) set(CPACK_GENERATOR "RPM") set(CPACK_PACKAGE_VERSION_MAJOR 1) set(CPACK_PACKAGE_VERSION_MINOR 2) set(CPACK_PACKAGE_NAME "project1") set(CPACK_RPM_PACKAGE_NAME "project1") set(CPACK_RPM_PACKAGE_SUMMARY "Some random calculator") set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64) set(CPACK_PACKAGE_VENDOR "Vendor Coorp.") set(CPACK_RPM_PACKAGE_MAINTAINER "Vendor Coorp.") INCLUDE(CPack) But calling the cpack command, I always getting the error "CPack project name not specified". Why is that? What I am missing? From kristianonline28 at gmail.com Wed Apr 6 20:26:44 2016 From: kristianonline28 at gmail.com (Kristian) Date: Thu, 7 Apr 2016 02:26:44 +0200 Subject: [CMake] Fwd: CPack does not generate a RPM In-Reply-To: References: Message-ID: Ok, one part of the problem, I could solve. I could solve the problem with running the following commands: cmake . && make package After that, I get a rpm package. But now, I have another problem and I do not know, if I am doing something wrong or if this is a bug. Let's assume, I have a library, e.g. liblibrary.so.5.6.7 and I have two symbolic links, so the result of "ls -l" would look like this liblibrary.so -> liblibrary.so.0 liblibrary.so.0 -> liblibrary.so.5.6.7 liblibrary.so.5.6.7 And let's assume, I have these lines in my CMakeLists.txt: ******* set(LIBRARIES ${LIB}/liblibrary.so ${LIB}/liblibrary.so.0 ${LIB}/liblibrary.so.5.6.7) #... install(FILES ${LIBRARIES} DESTINATION lib) ******* Now, I call the commands "cmake . && make package" and I get a package "project1.1-Linux.rpm". After that, I try to install that package with "yum install project1.1-Linux.rpm", I get some strange dependency resolution errors, which would look like this --> Finished Dependency Resolution Error: Package: project1.1-1.x86_64 (/project1.1-Linux) Requires: liblibrary.so.0()(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest But when I have only these lines in CMakeLists.txt ****** set(LIBRARIES ${LIB}/liblibrary.so.0 ${LIB}/liblibrary.so.5.6.7) #... install(FILES ${LIBRARIES} DESTINATION lib) ****** then installation of my very simple project works and I am not getting any dependency resolution errors. ---------- Forwarded message ---------- From: Kristian Date: 2016-04-07 0:50 GMT+02:00 Subject: CPack does not generate a RPM To: cmake at cmake.org Hi, I have an error and I do not know, how to solve this error. I have an archive, where are some files. I want to generate a rpm package with the files, which are in that archive. So first, I extract that archive with a bash script. After that, the script calls "cpack -G RPM -V ." for this CMakeLists.txt: cmake_minimum_required(VERSION 3.5) project(project1) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/usr/bin/calculator DESTINATION bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/usr/lib64/* DESTINATION lib) set(CPACK_GENERATOR "RPM") set(CPACK_PACKAGE_VERSION_MAJOR 1) set(CPACK_PACKAGE_VERSION_MINOR 2) set(CPACK_PACKAGE_NAME "project1") set(CPACK_RPM_PACKAGE_NAME "project1") set(CPACK_RPM_PACKAGE_SUMMARY "Some random calculator") set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64) set(CPACK_PACKAGE_VENDOR "Vendor Coorp.") set(CPACK_RPM_PACKAGE_MAINTAINER "Vendor Coorp.") INCLUDE(CPack) But calling the cpack command, I always getting the error "CPack project name not specified". Why is that? What I am missing? From philip.miller at sri.com Wed Apr 6 22:51:56 2016 From: philip.miller at sri.com (Philip Miller) Date: Thu, 7 Apr 2016 02:51:56 +0000 Subject: [CMake] Documenting CMakeLists.txt and custom or local .cmake files Message-ID: Two days ago I posted this question on StackOverflow, http://stackoverflow.com/q/36415261/3154588. I have not gotten an answer there, so I thought I would ask on this list. What are good ways to document my project ``CMakeLists.txt`` files and local project ``.cmake`` files? There is a two year old question/answer http://stackoverflow.com/q/21628833/3154588 that I am essentially asking here again. The answer contains the statement > Currently, CMake 3.0 is under development which will get a new documentation system based on Sphinx and reStructuredText. I guess that this will bring new ways to document your modules. I have looked at the [cmake developer documentation](https://cmake.org/cmake/help/v3.5/manual/cmake-developer.7.html?highlight=sphinx#id2), but this *new documentation system* seems geared towards the documentation of cmake itself. I do not see how I can use this to document my user-defined project ``CMakeLists.txt`` files or local ``.cmake`` files. I am hoping that since the cmake project internally has various sphinx directives and roles that there is was some way as a user I could take advantage of this internal usage of sphinx. I would like to be able to have some *markup* in my ``CMakeLists.txt`` files and local ``.cmake`` files without having to reinvent the wheel. There are related efforts in other projects. For example the ROS catkin project seems to offer the most complete approach that I have seen, but that is fairly heavyweight not easy to use for non-ROS projects. (As an example, look at their [extracted cmake api page](http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html).) The simplest, is the [sphinx-contrib](https://bitbucket.org/birkenfeld/sphinx-contrib/) cmakedomain, but that relies on a separate rst source doc rather than an *autodoc* approach with markup comments. I appreciate any help. Sincerely, Phil From iosif.neitzke+cmake at gmail.com Thu Apr 7 00:16:57 2016 From: iosif.neitzke+cmake at gmail.com (iosif neitzke) Date: Wed, 6 Apr 2016 23:16:57 -0500 Subject: [CMake] How to deal with generated source files (w/ dependency tracking) for globs In-Reply-To: References: Message-ID: I think it depends on when you want the output files from Nim generated and which files are the most frequently developed. If it is usually a one-time generation per clean development session, the simplest case, where the *.NIM source files are not the files most likely to be changed, I would think execute_process should work okay? cmake_minimum_required( VERSION 2.8.11 ) project( GenerateSomeFilesAndBuildThem C ) execute_process( COMMAND touch a.c a.h b.c b.h c.c c.h COMMAND echo "Generating some C files using NIM..." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) file( GLOB SRC ${CMAKE_CURRENT_BINARY_DIR}/*.c ${CMAKE_CURRENT_BINARY_DIR}/*.h ) add_executable( generated main.c ${SRC} ) target_include_directories( generated PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ) ... The C compiler identification is GNU 5.2.1 Check for working C compiler: /usr/bin/cc Check for working C compiler: /usr/bin/cc -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Detecting C compile features Detecting C compile features - done Generating some C files using NIM... Configuring done Generating done ... make Scanning dependencies of target generated [ 25%] Building C object CMakeFiles/generated.dir/main.c.o [ 50%] Building C object CMakeFiles/generated.dir/c.c.o [ 75%] Building C object CMakeFiles/generated.dir/a.c.o [100%] Building C object CMakeFiles/generated.dir/b.c.o Linking C executable generated [100%] Built target generated On Wed, Apr 6, 2016 at 8:55 AM, Nicholas Braden wrote: > Okay, so I tried my own suggesting and found that it doesn't work at > all (it's more complicated than I thought). However I want to ask you > about your logic here - you say that when the configure step runs, it > cancels XCode's build and so the user has to run the build a second > time. If we use a script to generate a file or just touch one of the > cmake files for every build, that means that every build will be > cancelled and XCode will never move on to actually compile anything. > The only way to actually let a build not be cancelled is either to run > `cmake --build .` from the command line instead of using the IDE, or > to not modify any CMake file, which requires some pretty elaborate > scripting to accomplish. Even just touching the modified date of a > CMake file will cause the configure step to run. At this point I think > you should just tell your users to manually run the configure step > whenever they add or remove a nim source file, because either way it > will be a two-click process. There is no way I see to have the magic > single-click build you want given XCode's limitations. But if you ever > do find a way I'd be interested to hear. > > (Though, I don't know how XCode treats External Projects - maybe you > could get it to work that way, but it'd be ugly) > > On Wed, Apr 6, 2016 at 6:28 AM, Eric Wing wrote: >> On 4/4/16, Nicholas Braden wrote: >>> I haven't tested this myself, but instead of using a glob, you could >>> have a build step that generates a CMake script file with the list of >>> generated files in it (e.g. via execute_process to run another CMake >>> script whose only job is to generate the CMake script inception-style) >>> and just include the generated file - CMake will see that the CMake >>> file has been modified during every build but will still handle source >>> file changes correctly. Worth a shot. >>> >> >> Thanks for the reply. So if I understand this correctly, this is what >> the workflow is going to feel like. >> >> - User adds their Nim file to the CMakeLists.txt >> - CMake detects a change and a bootstrap generate/update takes place, >> and my stuff re-runs the Nim compiler. >> - Also during this phase, I need to generate another CMake script >> which contains the list of files the Nim compiler output. >> - Since this other script is also under CMake change tracking, this >> will trigger another CMake change detection and >> bootstrap/generate/update. >> - Now the generated build system has the updated list of generated .c >> files to compile and will finally compile it. >> >> Does this sound right? >> >> My major concern is that the two bootstrap phases kind of break the >> flow. What I mean by that is that in Xcode for example, when a >> bootstrap/generate/update happens, it actually causes your Build/Run >> (run button) action to abort midway through. You sit there expecting >> it to build, but CMake's regeneration was the only thing that >> happened. You must hit the Run button again to actually build/run. >> Kind of annoying and also really confusing for people who don't >> understand this because it isn't obvious why this happened. >> >> But in the above example, there are now two bootstrap phases. So >> assuming this works, I think the user will have to hit the Run button >> at least 3 times before something actually builds/runs. I think this >> is going to feel real broken and feel like dumb luck something >> actually built. >> >> So I was hoping to find a one-step bootstrap solution instead of two-step. >> >> Thanks, >> Eric > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake From mosra at centrum.cz Thu Apr 7 02:48:52 2016 From: mosra at centrum.cz (=?utf-8?q?Vladim=C3=ADr_Vondru=C5=A1?=) Date: Thu, 07 Apr 2016 08:48:52 +0200 Subject: [CMake] =?utf-8?q?EFFECTIVE=5FPLATFORM=5FNAME_not_expanded_in_TAR?= =?utf-8?q?GET=5F*_generator_expressions_on_iOS?= In-Reply-To: <56FBC366.4090706@googlemail.com> References: <20160321134235.25B57D72@centrum.cz> <56FBC366.4090706@googlemail.com> Message-ID: <20160407084852.20910CD6@centrum.cz> Hello, sorry for the delayed reply. The root of the problem is actually not the XCtest feature, but generator expressions. The minimal repro case is just the following CMakeLists.txt file: cmake_minimum_required(VERSION 3.5) project(IosTarget C) file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/location.c CONTENT "#define LOCATION \"$\"" CONDITION $) add_library(lib STATIC ${CMAKE_CURRENT_BINARY_DIR}/location.c) Create build directory and invoke CMake like this: cmake .. -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -DCMAKE_OSX_ARCHITECTURES=armv7 -DCMAKE_C_COMPILER_WORKS=ON -G Xcode (I had to put the CMAKE_C_COMPILER_WORKS there because of https://cmake.org/Bug/view.php?id=15329 -- passing the CMAKE_MACOSX_BUNDLE and CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED on command-line somehow didn't work and I didn't want to inflate the repro case with a toolchain file. By the way, why CMake can't set those properties implicitly for the compiler tests?) Then, in the build directory a `location.c` file appears with contents similar to this: #define LOCATION "/path/to/the/project/build/Debug${EFFECTIVE_PLATFORM_NAME}/liblib.a" The expected value is however this: #define LOCATION "/path/to/the/project/build/Debug-iphoneos/liblib.a" Which corresponds to the location of the generated library if you run `cmake --build .` Hope the repro case is clear enough. Regards mosra ______________________________________________________________ > Od: Gregor Jasny > Komu: "Vladim?r Vondru?" , > Datum: 30.03.2016 14:15 > P?edm?t: Re: [CMake] EFFECTIVE_PLATFORM_NAME not expanded in TARGET_* generator expressions on iOS > >Hello, > >I fear you're one of the first users of the XCtest feature :) > >On 21/03/16 13:42, Vladim?r Vondru? wrote: >> Hello, >> >> I came across this problem when trying to use XCTest macros ( https://cmake.org/cmake/help/latest/module/FindXCTest.html ) on iOS. When compiling for OSX, ctest properly executes all test cases, but when targeting iOS or iOS simulator, all the test cases fail similarly to the following: >> >> 25: Test command: /Applications/Xcode.app/Contents/Developer/usr/bin/xctest "/Users/mosra/Code/corrade/build-ioss/src/Corrade/Utility/Test/Debug${EFFECTIVE_PLATFORM_NAME}/UtilityTypeTraitsTestRunner.xctest/../.." >> 25: Environment variables: >> 25: DYLD_FRAMEWORK_PATH=/Users/mosra/Code/corrade/build-ioss/src/Corrade/Utility/Test/Debug${EFFECTIVE_PLATFORM_NAME}/UtilityTypeTraitsTest.framework/.. >> 25: Test timeout computed to be: 9.99988e+06 >> 25: 2016-03-21 12:41:38.799 xctest[31113:31078264] The bundle ?Test? couldn?t be loaded because its executable couldn?t be located. Try reinstalling the bundle. >> 25/28 Test #25: UtilityTypeTraitsTest ...............***Failed 0.04 sec >> >> As you can see, the `${EFFECTIVE_PLATFORM_NAME}` is not being expanded to `-iphonesimulator` and thus the file is not found. The problem is that the `$` generator expression does not expand the variable. On the other hand, installation works without an issue, because the `cmake_install.cmake` scripts do additional round of variable expansion that (accidentally?) fixes this. The relevant part of the CMake source is here: https://github.com/Kitware/CMake/blob/cd569b962dbeaa7ea718021c16582cddd158df3a/Source/cmGeneratorTarget.cxx#L5063 >> >> From the source it looks like the generator is just putting the "${EFFECTIVE_PLATFORM_NAME}" output and hopes that someone later expands it. That's the case with install scripts (so they work), but not with generator expressions. The `TARGET_LINKER_FILE_DIR` is not the only affected, the problem is the same for all `TARGET_*` generator expressions. >> >> Currently I'm working around this by partially hardcoding the path, but that's far from ideal and I would like to avoid that: >> >> if(CMAKE_OSX_SYSROOT MATCHES "iPhoneOS") >> set(platform_name "-iphoneos") >> elseif(CMAKE_OSX_SYSROOT MATCHES "iPhoneSimulator") >> set(platform_name "-iphonesimulator") >> endif() >> set(target_linker_file_dir ${CMAKE_CURRENT_BINARY_DIR}/$${platform_name}/${target}.xctest) >> >> Is there any way to fix this directly in CMake? Also the above workaround works only when targeting single SDK and not when having single generated project for both the device and the simulator. > >Could you please send me a minimal example and a command line how you >invoke CMake? > >Thanks, >Gregor > From mosra at centrum.cz Thu Apr 7 03:22:28 2016 From: mosra at centrum.cz (=?utf-8?q?Vladim=C3=ADr_Vondru=C5=A1?=) Date: Thu, 07 Apr 2016 09:22:28 +0200 Subject: [CMake] =?utf-8?q?Better_handling_of_targets_consisting_of_object?= =?utf-8?q?_files_only?= Message-ID: <20160407092228.26D43A50@centrum.cz> Hello, I'm using `OBJECT` libraries quite a lot in my projects and more often than not I run into a situation where a target consists only of `$`. I know that CMake says the following about object libraries: "Some native build systems may not like targets that have only object files, so consider adding at least one real source file to any target that references $." One particular case of this is Xcode. But because my primary development happens with Ninja buildsystem, I don't experience the above issue at all until my CI starts testing with Xcode. Even then everything goes smoothly without any warning or error up to the final linking step, where the build just stops with something like this: clang: error: no such file or directory: '/path/to/the/project/build/Debug/liblib.a' And then I spend *hours* looking where the problem is until I realize that it's those `OBJECT` libraries again. That's where my question comes: Would it be possible to emit an error directly in the CMake configure/generate step for the affected buildsystems? In my experience it always led to linker error anyway, so why not inform the user as early as possible and hint what's the actual problem? (Or even better, because the solution is always to add a dummy C/C++ file to the target, it would be awesome if CMake could do just that implicitly. But I understand if that solution doesn't fit CMake's design.) Minimal repro case, to make it easier: cmake_minimum_required(VERSION 3.5) project(XcodeObject) add_library(objects OBJECT lib.cpp) add_library(lib STATIC $) add_executable(exe main.cpp) target_link_libraries(exe lib) The `lib.cpp` file is empty, the `main.cpp` is just `int main() {}`. Create build directory and experience the linker error with: cmake .. -G Xcode cmake --build . Thank you for your input. Regards mosra From mosra at centrum.cz Thu Apr 7 04:54:44 2016 From: mosra at centrum.cz (=?utf-8?q?Vladim=C3=ADr_Vondru=C5=A1?=) Date: Thu, 07 Apr 2016 10:54:44 +0200 Subject: [CMake] =?utf-8?q?Imported_target_location_for_OSX_frameworks?= Message-ID: <20160407105444.43C6C17A@centrum.cz> Hello, sorry for flooding with e-mails today, it all kinda piled up. This one is about imported target location for frameworks on OSX (and thus also iOS). I saw the bugreport here https://cmake.org/Bug/view.php?id=14105 and that it was closed as "no change needed". The suggested solution was that the Find module needs to practically work around this with a code similar to the following (for example finding the SDL2 framework installed through Homebrew on OSX): find_library(SDL2_LIBRARY SDL2) if(APPLE AND ${SDL2_LIBRARY} MATCHES "\\.framework$") set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY}/SDL2) else() set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY}) endif() It's ugly to do and I have to do it for all my custom modules that were switched to imported targets, but seeing that even the builtin `FindQt4.cmake` is doing the same, I thought that there is no way to use the nice old "just works" behavior that worked before imported targets. However, this requires that there actually *is* a file at `name.framework/name`, which is not always the case. One of those cases is the `OpenGLES` framework on iOS and for it I *have* to use the `-framework OpenGLES` way to make it work. In that case the workaround is like this: find_library(OpenGLES3 OpenGLES) # other platform-specific names omitted if(APPLE AND ${OPENGLES3_LIBRARY} MATCHES "\\.framework$") add_library(OpenGLES3::OpenGLES3 INTERFACE IMPORTED) set_property(TARGET OpenGLES3::OpenGLES3 APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${OPENGLES3_LIBRARY}) else() add_library(OpenGLES3::OpenGLES3 UNKNOWN IMPORTED) set_property(TARGET OpenGLES3::OpenGLES3 PROPERTY IMPORTED_LOCATION ${OPENGLES3_LIBRARY}) endif() You see that I actually have to completely sidestep the imported target functionality. Only this way the ${OPENGLES3_LIBRARY} location (which in this case is `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/OpenGLES.framework`) gets properly replaced with `-framework OpenGLES` on linker command line and everything works as it should. My question is: why CMake does not keep the old behavior also for imported targets? Is there any way to make it "just work" like it was with the old variable-based approach for finding libraries? I.e. not requiring the users to do elaborate platform-specific branching and introspection of each framework? Thanks for your input. mosra From attila.krasznahorkay at gmail.com Thu Apr 7 05:45:10 2016 From: attila.krasznahorkay at gmail.com (Attila Krasznahorkay) Date: Thu, 7 Apr 2016 11:45:10 +0200 Subject: [CMake] Documenting CMakeLists.txt and custom or local .cmake files In-Reply-To: References: Message-ID: <47FF9804-A157-46B5-891E-B3A6552CF844@gmail.com> Hi Philip, Unfortunately I can't give any insight on this. I just wanted to express my own interest in this question. As we'd also very much need a convenient way to document our CMake code. (Currently it's done on a Wiki page, which is out of date within 5 minutes of it being updated...) Cheers, Attila > On 07 Apr 2016, at 04:51, Philip Miller wrote: > > Two days ago I posted this question on StackOverflow, http://stackoverflow.com/q/36415261/3154588. I have not gotten an answer there, so I thought I would ask on this list. > > What are good ways to document my project ``CMakeLists.txt`` files and local project ``.cmake`` files? There is a two year old question/answer http://stackoverflow.com/q/21628833/3154588 that I am essentially asking here again. The answer contains the statement > >> Currently, CMake 3.0 is under development which will get a new documentation system based on Sphinx and reStructuredText. I guess that this will bring new ways to document your modules. > > I have looked at the [cmake developer documentation](https://cmake.org/cmake/help/v3.5/manual/cmake-developer.7.html?highlight=sphinx#id2), but this *new documentation system* seems geared towards the documentation of cmake itself. I do not see how I can use this to document my user-defined project ``CMakeLists.txt`` files or local ``.cmake`` files. > > I am hoping that since the cmake project internally has various sphinx directives and roles that there is was some way as a user I could take advantage of this internal usage of sphinx. I would like to be able to have some *markup* in my ``CMakeLists.txt`` files and local ``.cmake`` files without having to reinvent the wheel. There are related efforts in other projects. For example the ROS catkin project seems to offer the most complete approach that I have seen, but that is fairly heavyweight not easy to use for non-ROS projects. (As an example, look at their [extracted cmake api page](http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html).) The simplest, is the [sphinx-contrib](https://bitbucket.org/birkenfeld/sphinx-contrib/) cmakedomain, but that relies on a separate rst source doc rather than an *autodoc* approach with markup comments. > > I appreciate any help. > Sincerely, > Phil > -- > > 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 From domen.vrankar at gmail.com Thu Apr 7 13:39:28 2016 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Thu, 7 Apr 2016 19:39:28 +0200 Subject: [CMake] Fwd: CPack does not generate a RPM In-Reply-To: References: Message-ID: > Let's assume, I have a library, e.g. liblibrary.so.5.6.7 and I have > two symbolic links, so the result of "ls -l" would look like this > > liblibrary.so -> liblibrary.so.0 > liblibrary.so.0 -> liblibrary.so.5.6.7 > liblibrary.so.5.6.7 > > And let's assume, I have these lines in my CMakeLists.txt: > > ******* > set(LIBRARIES > ${LIB}/liblibrary.so > ${LIB}/liblibrary.so.0 > ${LIB}/liblibrary.so.5.6.7) > #... > install(FILES ${LIBRARIES} DESTINATION lib) > ******* > > Now, I call the commands "cmake . && make package" and I get a package > "project1.1-Linux.rpm". After that, I try to install that package with > "yum install project1.1-Linux.rpm", I get some strange dependency > resolution errors, which would look like this > > --> Finished Dependency Resolution > Error: Package: project1.1-1.x86_64 (/project1.1-Linux) > Requires: liblibrary.so.0()(64bit) > You could try using --skip-broken to work around the problem > You could try running: rpm -Va --nofiles --nodigest Hi, Not certain why that dependency problem occurs - will have to look into it a bit further but it seems to be rpm issue (somehow it gets the file dependencies wrong with symlinks to symlinks). As a workaround you could disable auto requirements generation by setting: set(CPACK_RPM_PACKAGE_AUTOREQ "NO") Regards, Domen From kristianonline28 at gmail.com Thu Apr 7 17:15:33 2016 From: kristianonline28 at gmail.com (Kristian) Date: Thu, 7 Apr 2016 23:15:33 +0200 Subject: [CMake] Fwd: CPack does not generate a RPM In-Reply-To: References: Message-ID: Thank you for your answer. Setting the variable CPACK_RPM_PACKAGE_AUTOREQ to "NO" worked. I also tried to produce a minimal example, which produces such error as the behaviour I described. But I couldn't generate such an example. I do not know currently, under which circumstances this happens :(. My assumptions are the same, that this seems to be a rpm issue. 2016-04-07 19:39 GMT+02:00 Domen Vrankar : >> Let's assume, I have a library, e.g. liblibrary.so.5.6.7 and I have >> two symbolic links, so the result of "ls -l" would look like this >> >> liblibrary.so -> liblibrary.so.0 >> liblibrary.so.0 -> liblibrary.so.5.6.7 >> liblibrary.so.5.6.7 >> >> And let's assume, I have these lines in my CMakeLists.txt: >> >> ******* >> set(LIBRARIES >> ${LIB}/liblibrary.so >> ${LIB}/liblibrary.so.0 >> ${LIB}/liblibrary.so.5.6.7) >> #... >> install(FILES ${LIBRARIES} DESTINATION lib) >> ******* >> >> Now, I call the commands "cmake . && make package" and I get a package >> "project1.1-Linux.rpm". After that, I try to install that package with >> "yum install project1.1-Linux.rpm", I get some strange dependency >> resolution errors, which would look like this >> >> --> Finished Dependency Resolution >> Error: Package: project1.1-1.x86_64 (/project1.1-Linux) >> Requires: liblibrary.so.0()(64bit) >> You could try using --skip-broken to work around the problem >> You could try running: rpm -Va --nofiles --nodigest > > Hi, > > Not certain why that dependency problem occurs - will have to look > into it a bit further but it seems to be rpm issue (somehow it gets > the file dependencies wrong with symlinks to symlinks). > > As a workaround you could disable auto requirements generation by setting: > set(CPACK_RPM_PACKAGE_AUTOREQ "NO") > > Regards, > Domen From peng.1.wang at nokia.com Fri Apr 8 02:31:27 2016 From: peng.1.wang at nokia.com (Wang, Peng 1. (Nokia - CN/Hangzhou)) Date: Fri, 8 Apr 2016 06:31:27 +0000 Subject: [CMake] Fwd: CPack does not generate a RPM In-Reply-To: References: Message-ID: <9193CFE72398F046892830C5FB1689215307F13E@SGSIMBX007.nsn-intra.net> Hi, Sorry guys, I am busy on some prioritized tasks. I've made a simple example, can I send in attachment? Or maybe I shall send the attachment only to you two? Wang Peng (Rex) Seat: 21F HZ SE Team +86018605811125 -----Original Message----- From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of EXT Kristian Sent: Friday, April 08, 2016 5:16 AM To: Domen Vrankar Cc: cmake at cmake.org Subject: Re: [CMake] Fwd: CPack does not generate a RPM Thank you for your answer. Setting the variable CPACK_RPM_PACKAGE_AUTOREQ to "NO" worked. I also tried to produce a minimal example, which produces such error as the behaviour I described. But I couldn't generate such an example. I do not know currently, under which circumstances this happens :(. My assumptions are the same, that this seems to be a rpm issue. 2016-04-07 19:39 GMT+02:00 Domen Vrankar : >> Let's assume, I have a library, e.g. liblibrary.so.5.6.7 and I have >> two symbolic links, so the result of "ls -l" would look like this >> >> liblibrary.so -> liblibrary.so.0 >> liblibrary.so.0 -> liblibrary.so.5.6.7 >> liblibrary.so.5.6.7 >> >> And let's assume, I have these lines in my CMakeLists.txt: >> >> ******* >> set(LIBRARIES >> ${LIB}/liblibrary.so >> ${LIB}/liblibrary.so.0 >> ${LIB}/liblibrary.so.5.6.7) >> #... >> install(FILES ${LIBRARIES} DESTINATION lib) >> ******* >> >> Now, I call the commands "cmake . && make package" and I get a package >> "project1.1-Linux.rpm". After that, I try to install that package with >> "yum install project1.1-Linux.rpm", I get some strange dependency >> resolution errors, which would look like this >> >> --> Finished Dependency Resolution >> Error: Package: project1.1-1.x86_64 (/project1.1-Linux) >> Requires: liblibrary.so.0()(64bit) >> You could try using --skip-broken to work around the problem >> You could try running: rpm -Va --nofiles --nodigest > > Hi, > > Not certain why that dependency problem occurs - will have to look > into it a bit further but it seems to be rpm issue (somehow it gets > the file dependencies wrong with symlinks to symlinks). > > As a workaround you could disable auto requirements generation by setting: > set(CPACK_RPM_PACKAGE_AUTOREQ "NO") > > Regards, > Domen -- 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 From kristianonline28 at gmail.com Fri Apr 8 04:27:58 2016 From: kristianonline28 at gmail.com (Kristian) Date: Fri, 8 Apr 2016 10:27:58 +0200 Subject: [CMake] Fwd: CPack does not generate a RPM In-Reply-To: <9193CFE72398F046892830C5FB1689215307F13E@SGSIMBX007.nsn-intra.net> References: <9193CFE72398F046892830C5FB1689215307F13E@SGSIMBX007.nsn-intra.net> Message-ID: I think others also may be interested in this. Please send a copy of your example ... 2016-04-08 8:31 GMT+02:00 Wang, Peng 1. (Nokia - CN/Hangzhou) : > Hi, > > Sorry guys, I am busy on some prioritized tasks. > I've made a simple example, can I send in attachment? Or maybe I shall send the attachment only to you two? > > Wang Peng (Rex) > Seat: 21F > HZ SE Team > +86018605811125 > > -----Original Message----- > From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of EXT Kristian > Sent: Friday, April 08, 2016 5:16 AM > To: Domen Vrankar > Cc: cmake at cmake.org > Subject: Re: [CMake] Fwd: CPack does not generate a RPM > > Thank you for your answer. Setting the variable > CPACK_RPM_PACKAGE_AUTOREQ to "NO" worked. > > I also tried to produce a minimal example, which produces such error > as the behaviour I described. But I couldn't generate such an example. > I do not know currently, under which circumstances this happens :(. > > My assumptions are the same, that this seems to be a rpm issue. > > 2016-04-07 19:39 GMT+02:00 Domen Vrankar : >>> Let's assume, I have a library, e.g. liblibrary.so.5.6.7 and I have >>> two symbolic links, so the result of "ls -l" would look like this >>> >>> liblibrary.so -> liblibrary.so.0 >>> liblibrary.so.0 -> liblibrary.so.5.6.7 >>> liblibrary.so.5.6.7 >>> >>> And let's assume, I have these lines in my CMakeLists.txt: >>> >>> ******* >>> set(LIBRARIES >>> ${LIB}/liblibrary.so >>> ${LIB}/liblibrary.so.0 >>> ${LIB}/liblibrary.so.5.6.7) >>> #... >>> install(FILES ${LIBRARIES} DESTINATION lib) >>> ******* >>> >>> Now, I call the commands "cmake . && make package" and I get a package >>> "project1.1-Linux.rpm". After that, I try to install that package with >>> "yum install project1.1-Linux.rpm", I get some strange dependency >>> resolution errors, which would look like this >>> >>> --> Finished Dependency Resolution >>> Error: Package: project1.1-1.x86_64 (/project1.1-Linux) >>> Requires: liblibrary.so.0()(64bit) >>> You could try using --skip-broken to work around the problem >>> You could try running: rpm -Va --nofiles --nodigest >> >> Hi, >> >> Not certain why that dependency problem occurs - will have to look >> into it a bit further but it seems to be rpm issue (somehow it gets >> the file dependencies wrong with symlinks to symlinks). >> >> As a workaround you could disable auto requirements generation by setting: >> set(CPACK_RPM_PACKAGE_AUTOREQ "NO") >> >> Regards, >> Domen > -- > > 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 From Gilles.Khouzam at microsoft.com Fri Apr 8 14:38:58 2016 From: Gilles.Khouzam at microsoft.com (Gilles Khouzam) Date: Fri, 8 Apr 2016 18:38:58 +0000 Subject: [CMake] Is there any ongoing work to support toolset Clang 3.7 with Microsoft CodeGen (v140_clang_3_7) In-Reply-To: <5c4c12f04b1012af541c526faef67fb4@smartmobili.com> References: <5c4c12f04b1012af541c526faef67fb4@smartmobili.com> Message-ID: Yes, support has been added to the nightly builds. Mariusz has added support for this. -----Original Message----- From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of forumer at smartmobili.com Sent: Friday, April 1, 2016 03:16 To: CMake ML Subject: [CMake] Is there any ongoing work to support toolset Clang 3.7 with Microsoft CodeGen (v140_clang_3_7) Hi, Microsoft has released a new toolset using clang for the code analysis and with VS2015 code generator. https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fblogs.msdn.microsoft.com%2fvcblog%2f2015%2f12%2f04%2fclang-with-microsoft-codegen-in-vs-2015-update-1%2f&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=pG0Tv%2fvB9Qjmmq9aEb82DM%2bSBDwJlzy4A2jLVaZ8888%3d https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fblogs.msdn.microsoft.com%2fvcblog%2f2016%2f01%2f20%2fclang-with-microsoft-codegen-january-2016-released%2f&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=9QSxh%2byHPkdB%2f8Ol6wDSWum3FOdoQ435OxhSy3OKgrQ%3d IS there any ongoing work to support the v140_clang_3_7 for VS2015 ? Something like: > cmake -G "Visual Studio 14 2015" -T v140_clang_3_7 For the moment if I want to test I have to use the VS2015 generator and then manually change the Platform Toolset and warnings level Thanks -- Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=G%2fForWqFnK6XXeeF3vjeXa79YHIUSYws0CePiG5ItFQ%3d Please keep messages on-topic and check the CMake FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.cmake.org%2fWiki%2fCMake_FAQ&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=xrhX%2bbBpZxVQVAdv8iFCPFavIPfIPQcrANkav5wO%2bnY%3d Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fcmake.org%2fcmake%2fhelp%2fsupport.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=2ob5oRjXSxdeHTP2SuA6ZAny0E30TH39gNr0gWNVLT0%3d CMake Consulting: https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fcmake.org%2fcmake%2fhelp%2fconsulting.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=cz13%2bFeBXYuzEwIo7EssNynhGTT3YopW1p9txFe684g%3d CMake Training Courses: https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fcmake.org%2fcmake%2fhelp%2ftraining.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=6ebJasb%2fjhGk3YD7u86BkS%2fV%2frjj9V1bljHHLHWYfdM%3d Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.kitware.com%2fopensource%2fopensource.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=99k6IYFVxiJdsEViMOj9ML5BTaPkMBnFqsdLJTEKbcs%3d Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fpublic.kitware.com%2fmailman%2flistinfo%2fcmake&data=01%7c01%7cgilles.khouzam%40microsoft.com%7c7703c2a8b7cb4a2db79b08d35a17a4c0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=uzH5ImTCdJ7DHdLQ3bGF82wF%2bBXf2RwHSBH6w6osnUY%3d From mmoelle1 at gmail.com Fri Apr 8 16:25:08 2016 From: mmoelle1 at gmail.com (=?utf-8?Q?Matthias_M=C3=B6ller?=) Date: Fri, 8 Apr 2016 22:25:08 +0200 Subject: [CMake] Include XYZ.cmake from external project Message-ID: <316AD094-A6B8-4397-8741-828C228C6D03@gmail.com> Dear all, I have difficulties including a XYZ.cmake file from an external project. ExternalProject_Add(MTL4 SVN_REPOSITORY https://simunova.zih.tu-dresden.de/svn/mtl4/trunk SVN_USERNAME guest SVN_PASSWORD guest SVN_TRUST_CERT 1 TIMEOUT 180 PREFIX ${CMAKE_BINARY_DIR}/external/MTL4 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ?" ) ExternalProject_Get_Property(MTL4 source_dir) set(MTL4_INCLUDE_DIRS ${source_dir}) set(MTL_DIR ${source_dir}) # Include MTLConfig from the unpacked(!!!) MTL4 library include("${source_dir}/MTLConfig.cmake" OPTIONAL RESULT_VARIABLE MTLCONFIG_FOUND) # MTL4 is a header-only library, hence downloading and unpacking is sufficient add_executable (demo demo.cxx) add_dependencies(demo MTL4) The problem is, that in a fresh build the MTL4 library is not yet unpacked, and hence, the MTLConfig.cmake file is not available. How can I ?include(?)? a cmake file which is only available after the external project has been processed? Kind regards, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholas11braden at gmail.com Fri Apr 8 16:27:19 2016 From: nicholas11braden at gmail.com (Nicholas Braden) Date: Fri, 8 Apr 2016 15:27:19 -0500 Subject: [CMake] Include XYZ.cmake from external project In-Reply-To: <316AD094-A6B8-4397-8741-828C228C6D03@gmail.com> References: <316AD094-A6B8-4397-8741-828C228C6D03@gmail.com> Message-ID: To solve the dependency order problem, generally you would make a superbuild which builds your dependencies and also your own project via ExternalProject, using the DEPENDS option to guarantee build order. This way all your dependencies are fully built and installed before it even gets to configuring your own project. On Fri, Apr 8, 2016 at 3:25 PM, Matthias M?ller wrote: > Dear all, > > I have difficulties including a XYZ.cmake file from an external project. > > ExternalProject_Add(MTL4 > SVN_REPOSITORY https://simunova.zih.tu-dresden.de/svn/mtl4/trunk > SVN_USERNAME guest > SVN_PASSWORD guest > SVN_TRUST_CERT 1 > TIMEOUT 180 > PREFIX ${CMAKE_BINARY_DIR}/external/MTL4 > CONFIGURE_COMMAND "" > BUILD_COMMAND "" > INSTALL_COMMAND ?" > ) > > ExternalProject_Get_Property(MTL4 source_dir) > set(MTL4_INCLUDE_DIRS ${source_dir}) > set(MTL_DIR ${source_dir}) > > # Include MTLConfig from the unpacked(!!!) MTL4 library > include("${source_dir}/MTLConfig.cmake" OPTIONAL RESULT_VARIABLE > MTLCONFIG_FOUND) > > > # MTL4 is a header-only library, hence downloading and unpacking is > sufficient > add_executable (demo demo.cxx) > add_dependencies(demo MTL4) > > The problem is, that in a fresh build the MTL4 library is not yet unpacked, > and hence, the MTLConfig.cmake file is not available. > How can I ?include(?)? a cmake file which is only available after the > external project has been processed? > > Kind regards, > Matthias > > > -- > > 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 From jagernicolas at legtux.org Fri Apr 8 18:39:41 2016 From: jagernicolas at legtux.org (jagernicolas at legtux.org) Date: Fri, 08 Apr 2016 18:39:41 -0400 Subject: [CMake] =?utf-8?q?how_to_add_custom_command/step_to_ExternalProje?= =?utf-8?q?ct=5FAdd_=3F?= Message-ID: <22abd5aea823a256dd47aa2ce5d365bf@legtux.org> Hi, my question is related to : http://stackoverflow.com/questions/36506300/using-autogen-sh-with-externalproject-add [1] I have to use ExternalProject_Add to compile https://github.com/fukuchi/libqrencode [2] as a gitmodule, it requires to run autogen.sh before running configure. I don't understand how to use ExternalProject_Add_Step to add a step before CONFIGURE_COMMAND. regards, Nicolas Links: ------ [1] http://stackoverflow.com/questions/36506300/using-autogen-sh-with-externalproject-add [2] https://github.com/fukuchi/libqrencode -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Fri Apr 8 19:30:42 2016 From: craig.scott at crascit.com (Craig Scott) Date: Sat, 9 Apr 2016 09:30:42 +1000 Subject: [CMake] Include XYZ.cmake from external project In-Reply-To: References: <316AD094-A6B8-4397-8741-828C228C6D03@gmail.com> Message-ID: Matthias, check out the following article which solves exactly the same problem as yours, just with GoogleTest as the third party package: https://crascit.com/2015/07/25/cmake-gtest/ It includes a fully general implementation hosted on github (MIT license) which you can use directly in your project. The technique discussed there causes the download to happen immediately so that the sources can be pulled in via add_subdirectory() without having to restructure your project as a superbuild. FWIW, a superbuild is also a good solution, the above article is just another alternative. On Sat, Apr 9, 2016 at 6:27 AM, Nicholas Braden wrote: > To solve the dependency order problem, generally you would make a > superbuild which builds your dependencies and also your own project > via ExternalProject, using the DEPENDS option to guarantee build > order. This way all your dependencies are fully built and installed > before it even gets to configuring your own project. > > On Fri, Apr 8, 2016 at 3:25 PM, Matthias M?ller > wrote: > > Dear all, > > > > I have difficulties including a XYZ.cmake file from an external project. > > > > ExternalProject_Add(MTL4 > > SVN_REPOSITORY https://simunova.zih.tu-dresden.de/svn/mtl4/trunk > > SVN_USERNAME guest > > SVN_PASSWORD guest > > SVN_TRUST_CERT 1 > > TIMEOUT 180 > > PREFIX ${CMAKE_BINARY_DIR}/external/MTL4 > > CONFIGURE_COMMAND "" > > BUILD_COMMAND "" > > INSTALL_COMMAND ?" > > ) > > > > ExternalProject_Get_Property(MTL4 source_dir) > > set(MTL4_INCLUDE_DIRS ${source_dir}) > > set(MTL_DIR ${source_dir}) > > > > # Include MTLConfig from the unpacked(!!!) MTL4 library > > include("${source_dir}/MTLConfig.cmake" OPTIONAL RESULT_VARIABLE > > MTLCONFIG_FOUND) > > > > > > # MTL4 is a header-only library, hence downloading and unpacking is > > sufficient > > add_executable (demo demo.cxx) > > add_dependencies(demo MTL4) > > > > The problem is, that in a fresh build the MTL4 library is not yet > unpacked, > > and hence, the MTLConfig.cmake file is not available. > > How can I ?include(?)? a cmake file which is only available after the > > external project has been processed? > > > > Kind regards, > > Matthias > > > > > > -- > > > > 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 -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From DLRdave at aol.com Fri Apr 8 22:05:52 2016 From: DLRdave at aol.com (David Cole) Date: Fri, 8 Apr 2016 22:05:52 -0400 Subject: [CMake] how to add custom command/step to ExternalProject_Add ? In-Reply-To: <22abd5aea823a256dd47aa2ce5d365bf@legtux.org> References: <22abd5aea823a256dd47aa2ce5d365bf@legtux.org> Message-ID: This file has an example use which executes after download and before configure: https://github.com/Kitware/CMake/blob/master/Tests/ExternalProjectLocal/CMakeLists.txt HTH, David C. > On Apr 8, 2016, at 6:39 PM, jagernicolas at legtux.org wrote: > > Hi, > > my question is related to : http://stackoverflow.com/questions/36506300/using-autogen-sh-with-externalproject-add > > I have to use ExternalProject_Add to compile https://github.com/fukuchi/libqrencode as a gitmodule, it requires to run autogen.sh before running configure. > > I don't understand how to use ExternalProject_Add_Step to add a step before CONFIGURE_COMMAND. > > > > regards, > > Nicolas > > > > > -- > > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Sat Apr 9 05:54:52 2016 From: craig.scott at crascit.com (Craig Scott) Date: Sat, 9 Apr 2016 19:54:52 +1000 Subject: [CMake] Using ccache with Xcode generator In-Reply-To: <56AFB9F9.2020506@googlemail.com> References: <56AFB9F9.2020506@googlemail.com> Message-ID: So it took me some time to find a technique, but it turns out there is a way to get ccache working with the Xcode generator, just not through RULE_LAUNCH_COMPILE. The full article explaining how is now available here: https://crascit.com/2016/04/09/using-ccache-with-cmake/ The general gist of the technique is to set up your CMakeLists.txt file like this: cmake_minimum_required(VERSION 2.8) find_program(CCACHE_PROGRAM ccache) if(CCACHE_PROGRAM) # Support Unix Makefiles and Ninja set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") endif() project(SomeProject) if(CCACHE_PROGRAM AND CMAKE_GENERATOR STREQUAL "Xcode") # Set up wrapper scripts configure_file(ccache-c.in ccache-c) configure_file(ccache-cxx.in ccache-cxx) execute_process(COMMAND chmod a+rx "${CMAKE_BINARY_DIR}/ccache-c" "${CMAKE_BINARY_DIR}/ccache-cxx") # Set Xcode project attributes to route compilation through our scripts set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/ccache-c") set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/ccache-cxx") endif() The two helper scripts ccache-c.in and ccache-cxx.in look like this: *ccache-c.in :* #!/bin/sh export CCACHE_CPP2=true exec "${CCACHE_PROGRAM}" "${CMAKE_C_COMPILER}" "$@" *ccache-cxx.in :* #!/bin/sh export CCACHE_CPP2=true exec "${CCACHE_PROGRAM}" "${CMAKE_CXX_COMPILER}" "$@" The above gives full ccache support for Unix Makefiles, Ninja and Xcode, with graceful fallback to normal non-ccache use where ccache is not available or supported by the developer's current version of CMake. My question now is, given that the above seems to highlight an avenue for Xcode projects, can CMake's support for RULE_LAUNCH_COMPILE be enhanced to support the Xcode generator too by populating the CC and CXX user-defined Xcode project settings? That would be a nice improvement to CMake for developers working on Apple platforms. On Tue, Feb 2, 2016 at 7:03 AM, Gregor Jasny wrote: > Hello, > > On 01/02/16 04:52, Craig Scott wrote: > > After a bit of experimenting, it seems that getting ccache working with > the > > Xcode generator isn't so straightforward. For Ninja and Unix Makefiles, > the > > RULE_LAUNCH_COMPILE global property nicely gives us the behaviour we > want, > > but this doesn't work for Xcode. Under the constraint that we can't > modify > > the build machines (meaning we can't assume ccache symlinks have been set > > up for the clang compiler set), is there a way to coax CMake to use > ccache > > with Xcode? I know I could write a wrapper script to explicitly invoke > > ccache, but this seems like something CMake should be able to do without > > having to resort to that. Any suggestions? > > I guess you will have to modify the SDK within Xcode to be able to > override the compiler for the SDK. > > As far as I remember Bullseye has the same problem to solve: > http://www.bullseye.com/help/tool-xcode.html > Maybe you can have a look there. > > Thanks, > Gregor > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.ryderrule at gmail.com Sun Apr 10 10:25:27 2016 From: matt.ryderrule at gmail.com (Matthew Rule) Date: Sun, 10 Apr 2016 15:25:27 +0100 Subject: [CMake] CMake download blocked by Google Chrome Message-ID: When trying to download cmake-3.5.1-win32-x86.msi from https://cmake.org/download/ I received the following message: https://i.gyazo.com/6cf9cd56e9cf1f513f649cf59f768241.png I'd assume that this message is displayed to most Chrome users (if Google uses and distributes a single collection of malware filter lists) so it should be a big concern. Is it currently safe to download software from cmake.org, or has someone injected malicious code into it? Why has this message come up? Can I ignore it safely? Thanks, Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From rwan.work at gmail.com Sun Apr 10 10:40:44 2016 From: rwan.work at gmail.com (Raymond Wan) Date: Sun, 10 Apr 2016 22:40:44 +0800 Subject: [CMake] CMake download blocked by Google Chrome In-Reply-To: References: Message-ID: Hi Matthew, On Sun, Apr 10, 2016 at 10:25 PM, Matthew Rule wrote: > When trying to download cmake-3.5.1-win32-x86.msi from > https://cmake.org/download/ I received the following message: > https://i.gyazo.com/6cf9cd56e9cf1f513f649cf59f768241.png > > I'd assume that this message is displayed to most Chrome users (if Google > uses and distributes a single collection of malware filter lists) so it > should be a big concern. Is it currently safe to download software from > cmake.org, or has someone injected malicious code into it? Why has this > message come up? Can I ignore it safely? I guess it is safe, but if you're not in a hurry, you can wait until the webmasters of cmake.org (not me) resolve the issue first so that Google removes the site from their warning list. According to: https://www.google.com/transparencyreport/safebrowsing/diagnostic/index.html#url=cmake.org Google seems to have marked it as "partially dangerous". Of course, Google could be wrong -- I think this filter list is maintained automatically and maybe they got the criteria wrong this time. Ray From cristian.adam at gmail.com Sun Apr 10 10:42:05 2016 From: cristian.adam at gmail.com (Cristian Adam) Date: Sun, 10 Apr 2016 16:42:05 +0200 Subject: [CMake] CMake download blocked by Google Chrome In-Reply-To: References: Message-ID: Hi, virustotal.com (which belongs to google) doesn't find any problems with the msi file. I assume Google Chrome panics because the file is not digitally signed by CMake.org. One can get an open source authenticode for 14? from Certum . Cheers, Cristian. On Sun, Apr 10, 2016 at 4:25 PM, Matthew Rule wrote: > When trying to download cmake-3.5.1-win32-x86.msi from > https://cmake.org/download/ I received the following message: > https://i.gyazo.com/6cf9cd56e9cf1f513f649cf59f768241.png > > I'd assume that this message is displayed to most Chrome users (if Google > uses and distributes a single collection of malware filter lists) so it > should be a big concern. Is it currently safe to download software from > cmake.org, or has someone injected malicious code into it? Why has this > message come up? Can I ignore it safely? > > Thanks, > > Matt > > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.ryderrule at gmail.com Sun Apr 10 10:45:11 2016 From: matt.ryderrule at gmail.com (Matthew Rule) Date: Sun, 10 Apr 2016 15:45:11 +0100 Subject: [CMake] CMake download blocked by Google Chrome In-Reply-To: References: Message-ID: Ok thanks for the responses. I will go ahead with the download in that case. Sorry if the question was a little offtopic for this mailing list, I see it's mostly technical discussion. Thanks, Matt On 10 April 2016 at 15:42, Cristian Adam wrote: > Hi, > > virustotal.com (which belongs to google) doesn't find any problems with > the msi file. > > I assume Google Chrome panics because the file is not digitally signed by > CMake.org. > > One can get an open source authenticode for 14? from Certum > > . > > > Cheers, > Cristian. > > On Sun, Apr 10, 2016 at 4:25 PM, Matthew Rule > wrote: > >> When trying to download cmake-3.5.1-win32-x86.msi from >> https://cmake.org/download/ I received the following message: >> https://i.gyazo.com/6cf9cd56e9cf1f513f649cf59f768241.png >> >> I'd assume that this message is displayed to most Chrome users (if Google >> uses and distributes a single collection of malware filter lists) so it >> should be a big concern. Is it currently safe to download software from >> cmake.org, or has someone injected malicious code into it? Why has this >> message come up? Can I ignore it safely? >> >> Thanks, >> >> Matt >> >> -- >> >> 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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rwan.work at gmail.com Sun Apr 10 10:52:28 2016 From: rwan.work at gmail.com (Raymond Wan) Date: Sun, 10 Apr 2016 22:52:28 +0800 Subject: [CMake] CMake download blocked by Google Chrome In-Reply-To: References: Message-ID: Hi Matthew, On Sun, Apr 10, 2016 at 10:45 PM, Matthew Rule wrote: > Ok thanks for the responses. I will go ahead with the download in that case. > Sorry if the question was a little offtopic for this mailing list, I see > it's mostly technical discussion. ...I don't know. Your query could be "on-topic" since it at least helps draw attention to the problem to the web masters of cmake.org. Maybe it's nothing; or maybe a harmful file did sneak on to the site. Anyway, not everyone will know that Google has marked the site as "partially dangerous" since others may use other browsers (i.e., I use Firefox and received no warning). Ray From matt.ryderrule at gmail.com Sun Apr 10 11:04:58 2016 From: matt.ryderrule at gmail.com (Matthew Rule) Date: Sun, 10 Apr 2016 16:04:58 +0100 Subject: [CMake] CMake download blocked by Google Chrome In-Reply-To: References: Message-ID: FYI I don't think it has to do with digital signing because I also have the same problem with the Windows ZIP. Anyway, I'll trust it. Thanks Matt On 10 April 2016 at 15:42, Cristian Adam wrote: > Hi, > > virustotal.com (which belongs to google) doesn't find any problems with > the msi file. > > I assume Google Chrome panics because the file is not digitally signed by > CMake.org. > > One can get an open source authenticode for 14? from Certum > > . > > > Cheers, > Cristian. > > On Sun, Apr 10, 2016 at 4:25 PM, Matthew Rule > wrote: > >> When trying to download cmake-3.5.1-win32-x86.msi from >> https://cmake.org/download/ I received the following message: >> https://i.gyazo.com/6cf9cd56e9cf1f513f649cf59f768241.png >> >> I'd assume that this message is displayed to most Chrome users (if Google >> uses and distributes a single collection of malware filter lists) so it >> should be a big concern. Is it currently safe to download software from >> cmake.org, or has someone injected malicious code into it? Why has this >> message come up? Can I ignore it safely? >> >> Thanks, >> >> Matt >> >> -- >> >> 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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michibrandl at gmx.net Mon Apr 11 06:31:29 2016 From: michibrandl at gmx.net (Michael Brandl) Date: Mon, 11 Apr 2016 12:31:29 +0200 Subject: [CMake] Firefox and chrome warnings when dowloading cmake windows installers Message-ID: An HTML attachment was scrubbed... URL: From nicholas11braden at gmail.com Mon Apr 11 08:35:30 2016 From: nicholas11braden at gmail.com (Nicholas Braden) Date: Mon, 11 Apr 2016 07:35:30 -0500 Subject: [CMake] Firefox and chrome warnings when dowloading cmake windows installers In-Reply-To: References: Message-ID: Previously there was a discussion about only Chrome: http://public.kitware.com/pipermail/cmake/2016-April/063192.html Good to know Firefox is affected too. For now I don't think anyone actually knows whether the file in question is truly dangerous or not, so use at your own risk. From what I've read it looks like this needs to be fixed on CMake's end by signing the MSI file. (I guess Google hates unsigned MSIs but is perfectly fine with unsigned EXEs) On Mon, Apr 11, 2016 at 5:31 AM, Michael Brandl wrote: > Hi, > > when trying to download any of the windows-installers from the download-page > (e.g. https://cmake.org/files/v3.4/cmake-3.4.3-win32-x86.exe), both firefox > and chrome issue security warnings: > > Firefox: > "Reported Unwanted Software Page! > This web page at cmake.org has been reported to contain unwanted software > and has been blocked based on your security preferences. > Unwanted software pages try to install software that can be deceptive and > affect your system in unexpected ways." > > Chrome: > "The site ahead contains harmful programs > Attackers on cmake.org might attempt to trick you into installing programs > that harm your browsing experience (for example, by changing your homepage > or showing extra ads on sites that you visit)." > > More info from google: > https://www.google.com/transparencyreport/safebrowsing/diagnostic/index.html?hl=en-GB#url=https://cmake.org/files/v3.5/cmake-3.5.1-win32-x86.msi > "Current status: > Dangerous > cmake.org/files/v3.5 contains harmful programs." > > Is this known to the community? > Can the downloads at cmake.org be trusted? > > I did not find any direct links related to the issue and cmake except for > this vaguely related one one from summer 2015: > https://cmake.org/pipermail/cmake-developers/2015-July/025784.html. > > Best regards, > > Michael > > -- > > 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 From bill.hoffman at kitware.com Mon Apr 11 11:15:22 2016 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Mon, 11 Apr 2016 11:15:22 -0400 Subject: [CMake] CMake download blocked by Google Chrome In-Reply-To: References: Message-ID: <570BBF8A.8000405@kitware.com> On 4/10/2016 10:40 AM, Raymond Wan wrote: > Google seems to have marked it as "partially dangerous". Of course, > Google could be wrong -- I think this filter list is maintained > automatically and maybe they got the criteria wrong this time. We are looking into this. We have had false positives in the past for virus checkers and the downloads in the past. -Bill From mjsurette at gmail.com Tue Apr 12 01:43:05 2016 From: mjsurette at gmail.com (Michael Surette) Date: Tue, 12 Apr 2016 01:43:05 -0400 Subject: [CMake] Setting properties from within a function Message-ID: I would like to use set target properties from within a function. ie function(MINE TGT DEF) target_compile_definitions("${TGT}" "${DEF}") endfunction(MINE TGT DEF) This doesn't work. If I change it to a macro, it does. macro(MINE TGT DEF) target_compile_definitions("${TGT}" "${DEF}") endmacro(MINE TGT DEF) Is there a way to extend the scope of TGT in the function so that the function variant works? TIA Mike From j.wuttke at fz-juelich.de Tue Apr 12 07:22:38 2016 From: j.wuttke at fz-juelich.de (Joachim Wuttke) Date: Tue, 12 Apr 2016 13:22:38 +0200 Subject: [CMake] FindBoost does not detect absence of header file Message-ID: <570CDA7E.3010403@fz-juelich.de> FindBoost does not detect absence of header files. To be specific: Run the following under cmake version 3.5.1: set(Boost_NO_BOOST_CMAKE ON) # prevent shortcut set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) add_definitions(-DBOOST_ALL_DYN_LINK) # line is needed for MSVC #add_definitions(-DBOOST_LIB_DIAGNOSTIC) # shows during compilation auto-linked libraries if(WIN32) set(boost_libraries_required date_time chrono program_options zlib bzip2 iostreams system filesystem regex thread) else() set(boost_libraries_required date_time chrono program_options iostreams system filesystem regex thread) endif() find_package(Boost 1.48.0 COMPONENTS ${boost_libraries_required} REQUIRED) message(STATUS "--> Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") message(STATUS " Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}") message(STATUS " Boost_LIBRARIES: ${Boost_LIBRARIES}") It will pass, even if files like /usr/include/boost/date_time.hpp &c are removed from the system. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5033 bytes Desc: S/MIME Cryptographic Signature URL: From bballet at ivsweb.com Tue Apr 12 11:29:51 2016 From: bballet at ivsweb.com (Benjamin Ballet) Date: Tue, 12 Apr 2016 17:29:51 +0200 Subject: [CMake] issue with target_link_libraries and MSVC Message-ID: I'm trying to add the openmp flag to a target with target_link_libraries. \openmp is interpreted as a file name and visual try to link to \openmp.obj The documentation state that target_link_libraries see an item as a flag if it start with - but MSVC flags start with \ Is there a way to add a link flags to a target with target_link_libraries and MSVC ? Thank you all -- *Benjamin BALLET* Ing?nieur R&D *ACTIVISU* 19, rue Klock - 92110 Clichy *> Standard T?l* : 01 44 69 37 37 *>* www.activisu.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From kristianonline28 at gmail.com Tue Apr 12 12:35:10 2016 From: kristianonline28 at gmail.com (Kristian) Date: Tue, 12 Apr 2016 18:35:10 +0200 Subject: [CMake] issue with target_link_libraries and MSVC In-Reply-To: References: Message-ID: I'm not sure, but I think, you should consider 'set_target_properties' (https://cmake.org/cmake/help/v3.0/command/set_target_properties.html). E.g. target_link_libraries(my_target source1.cpp source2.cpp) set_target_properties(my_target PROPERTIES LINK_FLAGS "\openmp") 2016-04-12 17:29 GMT+02:00 Benjamin Ballet via CMake : > I'm trying to add the openmp flag to a target with target_link_libraries. > \openmp is interpreted as a file name and visual try to link to \openmp.obj > > The documentation state that target_link_libraries see an item as a flag if > it start with - but MSVC flags start with \ > > Is there a way to add a link flags to a target with target_link_libraries > and MSVC ? > > Thank you all > > -- > Benjamin BALLET > Ing?nieur R&D > > ACTIVISU > 19, rue Klock - 92110 Clichy >> Standard T?l : 01 44 69 37 37 >> www.activisu.com > > -- > > 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 From boxerab at gmail.com Tue Apr 12 14:26:46 2016 From: boxerab at gmail.com (Aaron Boxer) Date: Tue, 12 Apr 2016 14:26:46 -0400 Subject: [CMake] ASAN error Message-ID: Hello, I am running on Ubuntu 15.10, with g++ 5.2.1 I have built my cmake project with ASAN and UBSAN. When I run the ctest nightly memory check, all of my tests fail with the error Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING Has anyone encountered this? If I just run make test, then I don't get these errors. Thanks, Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: From rcdailey.lists at gmail.com Tue Apr 12 14:54:01 2016 From: rcdailey.lists at gmail.com (Robert Dailey) Date: Tue, 12 Apr 2016 13:54:01 -0500 Subject: [CMake] Changing FOLDER property of ALL_BUILD and RUN_TESTS targets in VS Message-ID: I have the following CMake code: get_property( predefined_folder GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ) set_target_properties( ALL_BUILD PROPERTIES FOLDER ${predefined_folder} ) if( BUILD_TESTING ) set_target_properties( RUN_TESTS PROPERTIES FOLDER "Testing" ) endif() However this fails stating those targets do not exist. Is there a way I can make this work? I'd like to organize these CMake targets in my own way in the Visual Studio solution. There have been topics regarding this on the mailing list in the past, but they have gone unanswered. Specifically, why are these targets treated as if they do not exist? Does CMake only allow you to set properties on targets created directly by the scripts themselves (i.e. no built-in targets can be affected)? I'm happy to contribute a patch to this if needed. Thanks in advance. From brad.king at kitware.com Tue Apr 12 15:05:11 2016 From: brad.king at kitware.com (Brad King) Date: Tue, 12 Apr 2016 15:05:11 -0400 Subject: [CMake] [cmake-developers] Changing FOLDER property of ALL_BUILD and RUN_TESTS targets in VS In-Reply-To: References: Message-ID: <570D46E7.1050400@kitware.com> On 04/12/2016 02:54 PM, Robert Dailey wrote: > set_target_properties( ALL_BUILD PROPERTIES FOLDER ${predefined_folder} ) > > if( BUILD_TESTING ) > set_target_properties( RUN_TESTS PROPERTIES FOLDER "Testing" ) > endif() > > However this fails stating those targets do not exist. They don't exist because they are not created until generate-time. FYI recent changes in 'master' move ALL_BUILD into the predefined targets folder. > Does CMake only allow you to set properties on targets created > directly by the scripts themselves (i.e. no built-in targets can be > affected)? Correct. See above. This is not trivial to change because the ALL_BUILD, INSTALL, etc. targets are not normal targets. Internally they have type GLOBAL_TARGET. There can be *multiple* such targets of the same name created by the generators. Each directory whose CMakeLists.txt file calls project(SomeName) gets a SomeName.sln in VS, for example. Each such .sln has a different ALL_BUILD target with its own dependencies. The generators can get away with this because nothing ever looks up these targets by name. Therefore trying to present such targets to CMake project code is not well-defined. -Brad From annulen at yandex.ru Tue Apr 12 15:32:09 2016 From: annulen at yandex.ru (Konstantin Tokarev) Date: Tue, 12 Apr 2016 22:32:09 +0300 Subject: [CMake] Automoc for a part of target sources Message-ID: <804211460489529@web26g.yandex.ru> Hi all, Is it somehow possible to apply automoc-like processing to the list of files, not whole target? My use case: in QtWebKit most of sources composing core targets are not related to Qt at all, but there are specific sources specific to Qt port. Currently I'm using automoc, but I suspect that it should be possible to improve incremental build times by reducing number of automoc'ed files. -- Regards, Konstantin From tamas.kenez at gmail.com Tue Apr 12 18:57:23 2016 From: tamas.kenez at gmail.com (=?UTF-8?B?VGFtw6FzIEtlbsOpeg==?=) Date: Wed, 13 Apr 2016 00:57:23 +0200 Subject: [CMake] Setting properties from within a function In-Reply-To: References: Message-ID: I don't get how come the macro works because `target_compile_definitions` needs at least 3 parameters. The second one must be PRIVATE|PUBLIC|INTERFACE. Tamas On Tue, Apr 12, 2016 at 7:43 AM, Michael Surette wrote: > I would like to use set target properties from within a function. ie > > function(MINE TGT DEF) > target_compile_definitions("${TGT}" "${DEF}") > endfunction(MINE TGT DEF) > > This doesn't work. If I change it to a macro, it does. > > macro(MINE TGT DEF) > target_compile_definitions("${TGT}" "${DEF}") > endmacro(MINE TGT DEF) > > Is there a way to extend the scope of TGT in the function so that the > function variant works? > > TIA > > Mike > > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjsurette at gmail.com Tue Apr 12 22:54:18 2016 From: mjsurette at gmail.com (Michael Surette) Date: Tue, 12 Apr 2016 22:54:18 -0400 Subject: [CMake] Setting properties from within a function In-Reply-To: References: Message-ID: On 2016-04-12 06:57 PM, Tam?s Ken?z wrote: > I don't get how come the macro works because > `target_compile_definitions` needs at least 3 parameters. The second one > must be PRIVATE|PUBLIC|INTERFACE. > Tamas > > On Tue, Apr 12, 2016 at 7:43 AM, Michael Surette > > wrote: > > I would like to use set target properties from within a function. ie > > function(MINE TGT DEF) > target_compile_definitions("${TGT}" "${DEF}") > endfunction(MINE TGT DEF) > > This doesn't work. If I change it to a macro, it does. > > macro(MINE TGT DEF) > target_compile_definitions("${TGT}" "${DEF}") > endmacro(MINE TGT DEF) > > Is there a way to extend the scope of TGT in the function so that > the function variant works? Good catch. Actually, I have the (usually PRIVATE) part as the beginning of ${DEF}. To clarify, this is a question about scoping. If the command in the function was a "set" I could do set("${TGT}" "${DEF}" PARENT_SCOPE) In my example, what I want to do is set the target_compile_definitions of the name "${TGT}". A function is preferable to a macro so I can avoid namespace collisions. This is not all that this function does of course, or I would just call target_compile_definitions directly, but I cut out the other stuff to simplify the example. Upon further thought, perhaps you are on to something, let me do some testing. In the meantime, any more thoughts would be appreciated. Mike From philip.miller at sri.com Wed Apr 13 01:02:11 2016 From: philip.miller at sri.com (Philip Miller) Date: Wed, 13 Apr 2016 05:02:11 +0000 Subject: [CMake] Documenting CMakeLists.txt and custom or local .cmake files In-Reply-To: References: Message-ID: I was hoping to get a little guidance on my question of how to document my CMakeLists.txt and other .cmake files. Any suggestions of how, as a cmake user, one may take advantage of the sphinx documentation scheme that cmake uses for its documentation? -----Original Message----- From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Philip Miller Sent: Wednesday, April 06, 2016 10:52 PM To: cmake at cmake.org Subject: [CMake] Documenting CMakeLists.txt and custom or local .cmake files Two days ago I posted this question on StackOverflow, http://stackoverflow.com/q/36415261/3154588. I have not gotten an answer there, so I thought I would ask on this list. What are good ways to document my project ``CMakeLists.txt`` files and local project ``.cmake`` files? There is a two year old question/answer http://stackoverflow.com/q/21628833/3154588 that I am essentially asking here again. The answer contains the statement > Currently, CMake 3.0 is under development which will get a new documentation system based on Sphinx and reStructuredText. I guess that this will bring new ways to document your modules. I have looked at the [cmake developer documentation](https://cmake.org/cmake/help/v3.5/manual/cmake-developer.7.html?highlight=sphinx#id2), but this *new documentation system* seems geared towards the documentation of cmake itself. I do not see how I can use this to document my user-defined project ``CMakeLists.txt`` files or local ``.cmake`` files. I am hoping that since the cmake project internally has various sphinx directives and roles that there is was some way as a user I could take advantage of this internal usage of sphinx. I would like to be able to have some *markup* in my ``CMakeLists.txt`` files and local ``.cmake`` files without having to reinvent the wheel. There are related efforts in other projects. For example the ROS catkin project seems to offer the most complete approach that I have seen, but that is fairly heavyweight not easy to use for non-ROS projects. (As an example, look at their [extracted cmake api page](http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html).) The simplest, is the [sphinx-contrib](https://bitbucket.org/birkenfeld/sphinx-contrib/) cmakedomain, but that relies on a separate rst source doc rather than an *autodoc* approach with markup comments. I appreciate any help. Sincerely, Phil -- 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 From nicholas11braden at gmail.com Wed Apr 13 01:04:13 2016 From: nicholas11braden at gmail.com (Nicholas Braden) Date: Wed, 13 Apr 2016 00:04:13 -0500 Subject: [CMake] find_package: request/proposal for better version matching support Message-ID: I've run into a bit of an issue with the find_package interface. Let's say I want to use a library libsemver: find_package(semver REQUIRED) Now, I want my code to work even when libsemver releases new versions with breaking API changes, and I happen to know they follow the semantic versioning system. So, I lock my project to any version where the major version is 1: find_package(semver 1 EXACT REQUIRED) This works for a while, but then I discover that version 1.0 is not sufficient and I need at least version 1.1 - but there's a problem. There are other versions after 1.1, such as 1.2, which contain new features and bug fixes that many users will want, but I still want to let my users use 1.1 if that's all they have installed on their system and/or they cannot upgrade to the newer versions. If I write `find_package(semver 1.1 REQUIRED)`, this allows it to find version 2 which has breaking API changes and will not allow my project to compile. If I write `find_package(semver 1.1 EXACT REQUIRED)` this does not allow it to find version 1.2 which my users may want to use for the new features and bug fixes. I don't currently see any direct way to say that the major version must be 'exact' and the minor version must be 'at least'. The only options I see are messy - for example, writing my own find module instead of using the existing one provided by libsemver, or trying to optionally find each known minor version in order of preference. Neither of these is a good option because it now forces my project to stay in sync with libsemver. As a result, the latter option will not allow me to go back to previous commits and try to compile them because their version lists will be out of date, and the former option will require me to manually keep my find module in sync with libsemver's find module by constantly patching it with the version hack instead of just simply copying it without changes. So it seems I am stuck between a rock and a hard place. If there is a better alternative or a way around this I don't know of, please enlighten me. I have done some thinking on this and I believe I have thought of a good way to fix this problem while retaining compatibility in CMake - that is, I know the general idea of what I would need to change in CMake itself and would be willing to create such a patch if it were simple enough. However, I want feedback before I go any further - this is my idea: Instead of only allowing EXACT in find_package, which requires all the specified version numbers to match (or whatever custom logic the find module uses), I would make it so you could instead specify one of EXACT_MAJOR, EXACT_MINOR, EXACT_PATCH, or EXACT_TWEAK. For example: find_package(semver 1.1 EXACT_MAJOR REQUIRED) The above would require the major version to be exactly 1, but the minor version need only be at least 1. Thus, 2.0 would not match, but 1.1 and 1.2 would. find_package(semver 1.2.3 EXACT_MINOR REQUIRED) The above would require the major version to be exactly 1, the minor version to be exactly 2, and the patch version to be at least 3. EXACT_MAJOR is implicitly set. Of course, implementing this in CMake itself would not be the end of the story - this would also require that the find module be aware of the new options. For existing find modules, they would behave as if EXACT were specified, and would need to be manually updated to account for the new EXACT_* options. But, EXACT would still be a valid option to use, so existing projects need not update all their find_package calls, and find modules don't need to be updated if nobody wants to support the new functionality. If you are wondering about edge cases, I have already thought of some and know how to deal with them - for example, `find_package(semver 1.1 EXACT_TWEAK REQUIRED)` would issue either an error or warning (not sure which is better). I think edge case discussion would be better suited to when/if this is actually being implemented - for now I just want general feedback. The basic functionality within CMake would probably be simple to implement (I assume), but CMake has a lot of find modules included with it that would need to be individually updated to support the new functionality, and I'm not sure if that should be in the same patch or not. Any feedback on this subject would be great - I'd love to resolve this problem or, even better, find out it isn't a problem in the first place. Again, if implementing the changes aren't too complicated I would even be willing to do the work and create the patch myself. I have implemented find modules with good versioning support myself and am familiar with how they work from that perspective, but I don't know how the internals of CMake look. About package config files - I'm really not sure what to do here, because the documentation for them explicitly states "When multiple package configuration files are available whose version files claim compatibility with the version requested it is unspecified which one is chosen. No attempt is made to choose a highest or closest version number." - it is for this reason that I personally prefer to use find modules instead so I can control the version selection behavior. I think it would still be possible to implement my changes with that no-guarantee clause in mind for package config files, but as I have never actually used a library with package config files nor implemented any myself, I'm not very sure. I feel much more confident about find modules. I think only package config version files would need to be updated in order to understand the new EXACT_* options, correct? And of course they could fall back on the original EXACT behavior. Thank you all for reading carefully, and I look forward to your thoughts and ideas. Nicholas "LB" Braden From Mateju.Miroslav at azd.cz Wed Apr 13 01:54:08 2016 From: Mateju.Miroslav at azd.cz (=?utf-8?B?TWF0xJtqxa8gTWlyb3NsYXYsIEluZy4=?=) Date: Wed, 13 Apr 2016 05:54:08 +0000 Subject: [CMake] issue with target_link_libraries and MSVC In-Reply-To: References: Message-ID: <30ec280bbeb34f30bfe1f23142c9d390@azdexchstore3.AZD.LOCAL> Hi Benjamin, MSVC flags start with ?forward? slashes: / (However, MSVC also accepts hyphens (-) in my experience.) Documentation for /openmp flag: https://msdn.microsoft.com/library/fw509c3b.aspx Best regards, Miroslav From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Benjamin Ballet via CMake Sent: Tuesday, April 12, 2016 5:30 PM To: cmake at cmake.org Subject: [CMake] issue with target_link_libraries and MSVC I'm trying to add the openmp flag to a target with target_link_libraries. \openmp is interpreted as a file name and visual try to link to \openmp.obj The documentation state that target_link_libraries see an item as a flag if it start with - but MSVC flags start with \ Is there a way to add a link flags to a target with target_link_libraries and MSVC ? Thank you all -- Benjamin BALLET Ing?nieur R&D ACTIVISU 19, rue Klock - 92110 Clichy > Standard T?l : 01 44 69 37 37 > www.activisu.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bballet at ivsweb.com Wed Apr 13 05:28:12 2016 From: bballet at ivsweb.com (Benjamin Ballet) Date: Wed, 13 Apr 2016 11:28:12 +0200 Subject: [CMake] issue with target_link_libraries and MSVC In-Reply-To: <30ec280bbeb34f30bfe1f23142c9d390@azdexchstore3.AZD.LOCAL> References: <30ec280bbeb34f30bfe1f23142c9d390@azdexchstore3.AZD.LOCAL> Message-ID: Ho yes, my bad, however there is still the same issue with forward slashes I receive the flag with FindOpenMP module. It's sad we can't do : target_link_libraries(... ${OpenMP_CXX_FLAGS}) for a few target In the end I add the flags for the whole project : set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 2016-04-13 7:54 GMT+02:00 Mat?j? Miroslav, Ing. : > Hi Benjamin, > > > > MSVC flags start with ?forward? slashes: / (However, MSVC also accepts > hyphens (-) in my experience.) > > Documentation for /openmp flag: > https://msdn.microsoft.com/library/fw509c3b.aspx > > > > Best regards, > > Miroslav > > > > *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Benjamin > Ballet via CMake > *Sent:* Tuesday, April 12, 2016 5:30 PM > *To:* cmake at cmake.org > *Subject:* [CMake] issue with target_link_libraries and MSVC > > > > I'm trying to add the openmp flag to a target with target_link_libraries. > > \openmp is interpreted as a file name and visual try to link to \openmp.obj > > > > The documentation state that target_link_libraries see an item as a flag > if it start with - but MSVC flags start with \ > > > > Is there a way to add a link flags to a target with target_link_libraries > and MSVC ? > > > > Thank you all > > > > -- > > *Benjamin BALLET* > Ing?nieur R&D > > > *ACTIVISU* > > 19, rue Klock - 92110 Clichy > > *> Standard T?l* : 01 44 69 37 37 > > *>* www.activisu.com > -- *Benjamin BALLET* Ing?nieur R&D *ACTIVISU* 19, rue Klock - 92110 Clichy *> Standard T?l* : 01 44 69 37 37 *>* www.activisu.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Mateju.Miroslav at azd.cz Wed Apr 13 06:16:05 2016 From: Mateju.Miroslav at azd.cz (=?utf-8?B?TWF0xJtqxa8gTWlyb3NsYXYsIEluZy4=?=) Date: Wed, 13 Apr 2016 10:16:05 +0000 Subject: [CMake] issue with target_link_libraries and MSVC In-Reply-To: References: <30ec280bbeb34f30bfe1f23142c9d390@azdexchstore3.AZD.LOCAL> Message-ID: <63573e5ae3b947d4ad9b28ceb732762d@azdexchstore3.AZD.LOCAL> The page I linked says /openmp is a compiler flag (not linker flag), so adding it to CMAKE_CXX_FLAGS instead of LINK_FLAGS makes perfect sense. Miroslav From: Benjamin Ballet [mailto:bballet at ivsweb.com] Sent: Wednesday, April 13, 2016 11:28 AM To: Mat?j? Miroslav, Ing. Cc: cmake at cmake.org Subject: Re: [CMake] issue with target_link_libraries and MSVC Ho yes, my bad, however there is still the same issue with forward slashes I receive the flag with FindOpenMP module. It's sad we can't do : target_link_libraries(... ${OpenMP_CXX_FLAGS}) for a few target In the end I add the flags for the whole project : set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 2016-04-13 7:54 GMT+02:00 Mat?j? Miroslav, Ing. >: Hi Benjamin, MSVC flags start with ?forward? slashes: / (However, MSVC also accepts hyphens (-) in my experience.) Documentation for /openmp flag: https://msdn.microsoft.com/library/fw509c3b.aspx Best regards, Miroslav From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Benjamin Ballet via CMake Sent: Tuesday, April 12, 2016 5:30 PM To: cmake at cmake.org Subject: [CMake] issue with target_link_libraries and MSVC I'm trying to add the openmp flag to a target with target_link_libraries. \openmp is interpreted as a file name and visual try to link to \openmp.obj The documentation state that target_link_libraries see an item as a flag if it start with - but MSVC flags start with \ Is there a way to add a link flags to a target with target_link_libraries and MSVC ? Thank you all -- Benjamin BALLET Ing?nieur R&D ACTIVISU 19, rue Klock - 92110 Clichy > Standard T?l : 01 44 69 37 37 > www.activisu.com -- Benjamin BALLET Ing?nieur R&D ACTIVISU 19, rue Klock - 92110 Clichy > Standard T?l : 01 44 69 37 37 > www.activisu.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bballet at ivsweb.com Wed Apr 13 09:19:47 2016 From: bballet at ivsweb.com (Benjamin Ballet) Date: Wed, 13 Apr 2016 15:19:47 +0200 Subject: [CMake] issue with target_link_libraries and MSVC In-Reply-To: <63573e5ae3b947d4ad9b28ceb732762d@azdexchstore3.AZD.LOCAL> References: <30ec280bbeb34f30bfe1f23142c9d390@azdexchstore3.AZD.LOCAL> <63573e5ae3b947d4ad9b28ceb732762d@azdexchstore3.AZD.LOCAL> Message-ID: I'v found a way to enable openmp for a few target only with target_link_libraries : I created an imported interface OpenMP and setted the property INTERFACE_COMPILE_OPTIONS 2016-04-13 12:16 GMT+02:00 Mat?j? Miroslav, Ing. : > The page I linked says /openmp is a compiler flag (not linker flag), so > adding it to CMAKE_CXX_FLAGS instead of LINK_FLAGS makes perfect sense. > > > > Miroslav > > > > *From:* Benjamin Ballet [mailto:bballet at ivsweb.com] > *Sent:* Wednesday, April 13, 2016 11:28 AM > *To:* Mat?j? Miroslav, Ing. > *Cc:* cmake at cmake.org > *Subject:* Re: [CMake] issue with target_link_libraries and MSVC > > > > Ho yes, my bad, however there is still the same issue with forward slashes > > > > I receive the flag with FindOpenMP module. It's sad we can't do : > > target_link_libraries(... ${OpenMP_CXX_FLAGS}) for a few target > > > > In the end I add the flags for the whole project : > > set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") > > > > 2016-04-13 7:54 GMT+02:00 Mat?j? Miroslav, Ing. : > > Hi Benjamin, > > > > MSVC flags start with ?forward? slashes: / (However, MSVC also accepts > hyphens (-) in my experience.) > > Documentation for /openmp flag: > https://msdn.microsoft.com/library/fw509c3b.aspx > > > > Best regards, > > Miroslav > > > > *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Benjamin > Ballet via CMake > *Sent:* Tuesday, April 12, 2016 5:30 PM > *To:* cmake at cmake.org > *Subject:* [CMake] issue with target_link_libraries and MSVC > > > > I'm trying to add the openmp flag to a target with target_link_libraries. > > \openmp is interpreted as a file name and visual try to link to \openmp.obj > > > > The documentation state that target_link_libraries see an item as a flag > if it start with - but MSVC flags start with \ > > > > Is there a way to add a link flags to a target with target_link_libraries > and MSVC ? > > > > Thank you all > > > > -- > > *Benjamin BALLET* > Ing?nieur R&D > > > *ACTIVISU* > > 19, rue Klock - 92110 Clichy > > *> Standard T?l* : 01 44 69 37 37 > > *>* www.activisu.com > > > > > > -- > > *Benjamin BALLET* > Ing?nieur R&D > > > *ACTIVISU* > > 19, rue Klock - 92110 Clichy > > *> Standard T?l* : 01 44 69 37 37 > > *>* www.activisu.com > -- *Benjamin BALLET* Ing?nieur R&D *ACTIVISU* 19, rue Klock - 92110 Clichy *> Standard T?l* : 01 44 69 37 37 *>* www.activisu.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tamas.kenez at gmail.com Wed Apr 13 09:20:42 2016 From: tamas.kenez at gmail.com (=?UTF-8?B?VGFtw6FzIEtlbsOpeg==?=) Date: Wed, 13 Apr 2016 15:20:42 +0200 Subject: [CMake] Setting properties from within a function In-Reply-To: References: Message-ID: Okay, I see. The problem is that the ${DEF} is quoted so it won't fall apart into separate arguments. Tam?s On Wed, Apr 13, 2016 at 4:54 AM, Michael Surette wrote: > On 2016-04-12 06:57 PM, Tam?s Ken?z wrote: > >> I don't get how come the macro works because >> `target_compile_definitions` needs at least 3 parameters. The second one >> must be PRIVATE|PUBLIC|INTERFACE. >> Tamas >> >> On Tue, Apr 12, 2016 at 7:43 AM, Michael Surette >> > > wrote: >> >> I would like to use set target properties from within a function. ie >> >> function(MINE TGT DEF) >> target_compile_definitions("${TGT}" "${DEF}") >> endfunction(MINE TGT DEF) >> >> This doesn't work. If I change it to a macro, it does. >> >> macro(MINE TGT DEF) >> target_compile_definitions("${TGT}" "${DEF}") >> endmacro(MINE TGT DEF) >> >> Is there a way to extend the scope of TGT in the function so that >> the function variant works? >> > > Good catch. > > Actually, I have the (usually PRIVATE) part as the beginning of ${DEF}. > > To clarify, this is a question about scoping. If the command in the > function was a "set" I could do > > set("${TGT}" "${DEF}" PARENT_SCOPE) > > In my example, what I want to do is set the target_compile_definitions of > the name "${TGT}". A function is preferable to a macro so I can avoid > namespace collisions. > > This is not all that this function does of course, or I would just call > target_compile_definitions directly, but I cut out the other stuff to > simplify the example. > > Upon further thought, perhaps you are on to something, let me do some > testing. > > In the meantime, any more thoughts would be appreciated. > > > Mike > > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjsurette at gmail.com Wed Apr 13 09:51:38 2016 From: mjsurette at gmail.com (Michael Surette) Date: Wed, 13 Apr 2016 09:51:38 -0400 Subject: [CMake] Setting properties from within a function In-Reply-To: References: Message-ID: On 13/04/16 09:20 AM, Tam?s Ken?z wrote: > Okay, I see. The problem is that the ${DEF} is quoted so it won't fall > apart into separate arguments. > Tam?s > Thanks, I'll give that a try tonight. Mike From jagernicolas at legtux.org Wed Apr 13 11:48:08 2016 From: jagernicolas at legtux.org (jagernicolas at legtux.org) Date: Wed, 13 Apr 2016 11:48:08 -0400 Subject: [CMake] =?utf-8?q?how_to_add_custom_command/step_to_ExternalProje?= =?utf-8?q?ct=5FAdd_=3F?= In-Reply-To: References: <22abd5aea823a256dd47aa2ce5d365bf@legtux.org> Message-ID: <7a1301a6d3d4c285324dfa26f44040d6@legtux.org> Hi David, thx, I solve the problem with answer I got on stack, http://stackoverflow.com/questions/36506300/using-autogen-sh-with-externalproject-add [1] regards, Nicolas On 2016-04-08 22:05, David Cole wrote: > This file has an example use which executes after download and before configure: > > https://github.com/Kitware/CMake/blob/master/Tests/ExternalProjectLocal/CMakeLists.txt [10] > > HTH, > David C. > > On Apr 8, 2016, at 6:39 PM, jagernicolas at legtux.org wrote: > >> Hi, >> >> my question is related to : http://stackoverflow.com/questions/36506300/using-autogen-sh-with-externalproject-add [1] >> >> I have to use ExternalProject_Add to compile https://github.com/fukuchi/libqrencode [2] as a gitmodule, it requires to run autogen.sh before running configure. >> >> I don't understand how to use ExternalProject_Add_Step to add a step before CONFIGURE_COMMAND. >> >> regards, >> >> Nicolas > >> -- >> >> Powered by www.kitware.com [3] >> >> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ [4] >> >> 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 [5] >> CMake Consulting: http://cmake.org/cmake/help/consulting.html [6] >> CMake Training Courses: http://cmake.org/cmake/help/training.html [7] >> >> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html [8] >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake [9] Links: ------ [1] http://stackoverflow.com/questions/36506300/using-autogen-sh-with-externalproject-add [2] https://github.com/fukuchi/libqrencode [3] http://www.kitware.com [4] http://www.cmake.org/Wiki/CMake_FAQ [5] http://cmake.org/cmake/help/support.html [6] http://cmake.org/cmake/help/consulting.html [7] http://cmake.org/cmake/help/training.html [8] http://www.kitware.com/opensource/opensource.html [9] http://public.kitware.com/mailman/listinfo/cmake [10] https://github.com/Kitware/CMake/blob/master/Tests/ExternalProjectLocal/CMakeLists.txt -------------- next part -------------- An HTML attachment was scrubbed... URL: From asiganael at yahoo.com Wed Apr 13 12:40:54 2016 From: asiganael at yahoo.com (Asiga Nael) Date: Wed, 13 Apr 2016 16:40:54 +0000 (UTC) Subject: [CMake] Unable to download cmake-3.5.1 (a 403 error) References: <731939.3863719.1460565654096.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <731939.3863719.1460565654096.JavaMail.yahoo@mail.yahoo.com> Hi, I'm trying to download the file cmake-3.5.1-Darwin-x86_64.dmg but it brings me to a page at public.kitware.com with a 403 error: "Permission Denied You do not have permission to retrieve the URL or link you requested." Is there any mirror hosting cmake releases, so that I can download it from other place? Thanks! From bill.hoffman at kitware.com Wed Apr 13 14:46:33 2016 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Wed, 13 Apr 2016 14:46:33 -0400 Subject: [CMake] Unable to download cmake-3.5.1 (a 403 error) In-Reply-To: <731939.3863719.1460565654096.JavaMail.yahoo@mail.yahoo.com> References: <731939.3863719.1460565654096.JavaMail.yahoo.ref@mail.yahoo.com> <731939.3863719.1460565654096.JavaMail.yahoo@mail.yahoo.com> Message-ID: <570E9409.3090409@kitware.com> On 4/13/2016 12:40 PM, Asiga Nael via CMake wrote: > Hi, > > I'm trying to download the file cmake-3.5.1-Darwin-x86_64.dmg but it brings me to a page at public.kitware.com with a 403 error: "Permission Denied You do not have permission to retrieve the URL or link you requested." > > Is there any mirror hosting cmake releases, so that I can download it from other place? Should be fixed now. -Bill From meinemailingliste2 at online.de Thu Apr 14 00:28:51 2016 From: meinemailingliste2 at online.de (Martin Maurer) Date: Thu, 14 Apr 2016 06:28:51 +0200 Subject: [CMake] Question on pathes/names of generated lib (CMake 3.5.1, Visual Studio 2015 - x64) Message-ID: Hi, I am trying to use CMake on a open source project called cryptominisat ( https://github.com/msoos/cryptominisat ) which is initially developed under Linux, but is meanwhile partly ported to Windows. Source can already compiled (with a batch file) and run, but not yet completely with cmake. It is also executed via AppVeyor, steps and log output see here: https://ci.appveyor.com/project/msoos/cryptominisat Mainly it is doing the following steps, also tried it on my local machine with downloaded and locally installed cmake 3.5.1 and Visual Studio 2015 in a x64 native tools command prompt: (replaced the %P% with c:\abc and I don't used logger DLL) cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=c:\abc msbuild "INSTALL.vcxproj" (I work in C:\projects\cryptominisat like AppVeyor) cmake seems to run, generating the *.vcxproj. During run these libs are generated: temp_lib_norm.lib and temp_lib_ipasir.lib Then there is a exe, but it always tell me it can't find ..\lib\Release\cryptominisat4.lib (using a different name then previous generated libs) It is doing Lib: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\Lib.exe /OUT:"temp_lib_norm.dir\Release\temp_lib_norm.lib" /NOLOGO /MACHINE:X64 /machine:x64 temp_lib_norm.dir\Release\cnf.obj -> This lib going to "temp_lib_norm.dir" Link: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\projects\cryptominisat\cmsat4-src\Release\cryptominisat4.dll" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/projects/cryptominisat/cmsat4-src/Release/cryptominisat4.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/projects/cryptominisat/lib/Release/cryptominisat4.lib" /MACHINE:X64 /machine:x64 /DLL "C:\projects\cryptominisat\cmsat4-src\temp_lib_norm.dir\Release\cnf.obj" -> This DLL going to "C:\projects\cryptominisat\cmsat4-src\Release\cryptominisat4.dll" Link: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\projects\cryptominisat\cmsat4-src\Release\cryptominisat4ipasir.dll" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ..\lib\Release\cryptominisat4.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/projects/cryptominisat/cmsat4-src/Release/cryptominisat4ipasir.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/projects/cryptominisat/lib/Release/cryptominisat4ipasir.lib" /MACHINE:X64 /machine:x64 /DLL "C:\projects\cryptominisat\cmsat4-src\temp_lib_ipasir.dir\Release\ipasir.obj" LINK : fatal error LNK1181: cannot open input file '..\lib\Release\cryptominisat4.lib' [C:\projects\cryptominisat\cmsat4-src\libcryptominisat4ipasir.vcxproj] -> This time "..\lib\Release\cryptominisat4.lib" There seems to be a mixture of lib pathes and names, but interesting thing is, it seems to be working under Linux. I see that temp_lib_norm.lib is built in "cmsat4-src\temp_lib_norm.dir", but there seems to be no cryptominisat4.lib at all in these directories. I think this is the code for copying one lib to another: ( complete file see https://github.com/msoos/cryptominisat/blob/master/src/CMakeLists.txt line 151 ) add_library(libcryptominisat4 SHARED ${cms_lib_objects_norm}) target_link_libraries(libcryptominisat4 LINK_PUBLIC ${cryptoms_lib_link_libs} ) whereas list(APPEND cms_lib_objects_norm $) and add_library(temp_lib_norm OBJECT ${cryptoms_lib_files} cryptominisat.cpp ) and set(cryptoms_lib_files cnf.cpp propengine.cpp varreplacer.cpp ... ) I am fairly new to cmake, just bought "mastering cmake" a few days ago and reading and trying a lot, but still don't know how to debug this and where to start at all. Can someone give me a hint? Where is the correct place to store this *.lib and/or *.dll? Are there some which fail under Windows (with Visual Studio 2015) but work on Linux? Many thanks for helping! Best regards, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From ewmailing at gmail.com Thu Apr 14 06:40:41 2016 From: ewmailing at gmail.com (Eric Wing) Date: Thu, 14 Apr 2016 03:40:41 -0700 Subject: [CMake] How to deal with generated source files (w/ dependency tracking) for globs In-Reply-To: References: Message-ID: On 4/6/16, iosif neitzke wrote: > I think it depends on when you want the output files from Nim > generated and which files are the most frequently developed. > If it is usually a one-time generation per clean development session, > the simplest case, where the *.NIM source files are not the files > most likely to be changed, I would think execute_process should > work okay? > Thanks for the responses. In this case, the common use case would be writing/changing the NIM files, which in turn require the C files to be rewritten. (The users are writing in NIM, and C generation to them is just an implementation detail and means to an end.) It sounds like this is going to be a pain. I appreciate everybody's responses on this. Thanks, Eric From davidshen84 at gmail.com Thu Apr 14 08:05:27 2016 From: davidshen84 at gmail.com (Xi Shen) Date: Thu, 14 Apr 2016 12:05:27 +0000 Subject: [CMake] c++11 feature and cmake feature name mapping Message-ID: Hi, I know we should use [target_compile_features][1] to enable c++11 features in cmake. And I also found the [descriptions][2] about the features. In my code I used the `random_device`, `default_random_engine` and `uniform_int_distribution` which are a new features, but I could not find a matching feature in the description. [1]: https://cmake.org/cmake/help/v3.1/command/target_compile_features.html [2]: https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES Thanks, David -- Regards, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Thu Apr 14 08:11:01 2016 From: craig.scott at crascit.com (Craig Scott) Date: Thu, 14 Apr 2016 22:11:01 +1000 Subject: [CMake] How to deal with generated source files (w/ dependency tracking) for globs In-Reply-To: References: Message-ID: It's not quite your situation, but it may have some common elements and the general idea may get you thinking about what might work for you. This question/answer I asked this list about last week: http://stackoverflow.com/q/36084785/1938798 We've been using this approach with success on all the platforms listed there. In your case, you may want to consider getting your tool that converts from Nim to C to do that off to the side and only replace the existing generated C sources with the new ones if they are different. That's what our particular tool in the above linked article does and it works rather well for us all as part of one single build. I haven't tried building within Xcode directly, but we do have scripted builds for iOS using the Xcode generator which are working. On Thu, Apr 14, 2016 at 8:40 PM, Eric Wing wrote: > On 4/6/16, iosif neitzke wrote: > > I think it depends on when you want the output files from Nim > > generated and which files are the most frequently developed. > > If it is usually a one-time generation per clean development session, > > the simplest case, where the *.NIM source files are not the files > > most likely to be changed, I would think execute_process should > > work okay? > > > > Thanks for the responses. In this case, the common use case would be > writing/changing the NIM files, which in turn require the C files to > be rewritten. (The users are writing in NIM, and C generation to them > is just an implementation detail and means to an end.) > > It sounds like this is going to be a pain. > > I appreciate everybody's responses on this. > > Thanks, > Eric > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Thu Apr 14 08:13:59 2016 From: craig.scott at crascit.com (Craig Scott) Date: Thu, 14 Apr 2016 22:13:59 +1000 Subject: [CMake] c++11 feature and cmake feature name mapping In-Reply-To: References: Message-ID: There are pros and cons to specifying individual compiler features compared to just specifying a C++ standard overall. It depends somewhat on what else you have to link in. For example, if you link to a third party library built with C++11 settings, you will have to link in that same library to avoid mismatched runtime library problems. More details in one of my blog articles about this here: https://crascit.com/2015/03/28/enabling-cxx11-in-cmake/ On Thu, Apr 14, 2016 at 10:05 PM, Xi Shen wrote: > Hi, > > I know we should use [target_compile_features][1] to enable c++11 features > in cmake. And I also found the [descriptions][2] about the features. > > In my code I used the `random_device`, `default_random_engine` and > `uniform_int_distribution` which are a new features, but I could not find a > matching feature in the description. > > > [1]: > https://cmake.org/cmake/help/v3.1/command/target_compile_features.html > [2]: > https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES > > Thanks, > David > > -- > > Regards, > David > > -- > > 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 > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Thu Apr 14 08:17:20 2016 From: craig.scott at crascit.com (Craig Scott) Date: Thu, 14 Apr 2016 22:17:20 +1000 Subject: [CMake] Building a tool immediately so it can be used later in same CMake run In-Reply-To: References: Message-ID: Sorry, forgot to follow up on this response. Re-using the same build directory is a key part of the technique to avoid having to build the same thing twice. So far, the only real problem I've seen is that the Xcode generator is potentially less suited to this arrangement in that it seems very hard to avoid building it twice even when using the same build directory. It all still works, just not necessarily as efficiently as I think it could. Haven't had time to delve deeper into the Xcode side yet to investigate further. The install targets option sounds like a good suggestion. I might play with that in the coming months. Cheers. On Sun, Apr 3, 2016 at 2:09 AM, Tam?s Ken?z wrote: > Craig, > > I'm sorry for my previous answer which I wrote in haste. Now I've read > your SO post and realized the question is a bit more complex then "is > execute_process safe instead of ExternalProject". > > Anyway I still think your approach is basically correct. I have the > following comments: > > - I wouldn't re-use the current build dir and would build mycomp always in > it's own build dir. Also, I'd always use the plain default cmake generator > (which is a must when crosscompiling anyway). No need to forward any > settings to it from the superbuild. Also, I'd always build the Release > config for mycomp. > > - You could "install(TARGETS mycomp DESTINATION bin)" in your EARLY_BUILD > then later use "find_program(mycomp_EXECUTABLE mycomp ...) later to save > guessing the executable's name. > > Tamas > > On Fri, Apr 1, 2016 at 9:25 PM, Tam?s Ken?z wrote: > >> Craig, >> >> My cmake-based build system in my company's CI framework works exactly >> that way: there's a generic cmake script[1] (invoked with cmake -P) that >> reads in a file which contains repo-urls and build parameters for 50+ >> projects and builds them for 3 platforms (linux, win, mac) 5 compilers >> (cross-compilers, too) invoking child cmake builds with execute_process. >> This is done after each push and one daily clean build. >> >> I've never had any problems with that approach. >> >> On the other hand, the system was originally designed with >> ExternalProject and I had many problems. >> >> [1]: https://github.com/tamaskenez/centralbuilder >> >> Tamas >> >> >> >> On Fri, Apr 1, 2016 at 1:53 AM, Craig Scott >> wrote: >> >>> All, >>> >>> I originally planned to ask this question directly on this mailing list, >>> but it got a bit more involved, so I posted it to stackoverflow instead. >>> I'm interested if anyone can shed some more authoritative light on the >>> proposed method for the following question: >>> >>> http://stackoverflow.com/q/36084785/1938798 >>> >>> *Short version*: invoke a nested cmake-and-build immediately within the >>> main CMake run to build a specific target via execute_process(). This makes >>> that tool available for use still within the same (main) CMake run. An >>> ExternalProject-based technique would normally be a better solution, but in >>> this particular case, that wasn't possible. >>> >>> I'd be interested if anyone can confirm whether the suggested approach >>> is guaranteed to be safe for all generators and platforms, or whether there >>> are other factors I have not considered in the proposed technique. >>> >>> Cheers >>> >>> -- >>> Craig Scott >>> Melbourne, Australia >>> http://crascit.com >>> >>> -- >>> >>> 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 >>> >> >> > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholas11braden at gmail.com Thu Apr 14 08:31:23 2016 From: nicholas11braden at gmail.com (Nicholas Braden) Date: Thu, 14 Apr 2016 07:31:23 -0500 Subject: [CMake] c++11 feature and cmake feature name mapping In-Reply-To: References: Message-ID: I don't think CMake can yet detect features of the standard library implementation, only features of the language. One compiler may support more features than another compiler which supports more of the standard library, and in some cases the same compiler can support two or more different standard libraries. I think you're better off requesting the language standard you want directly with CXX_STANDARD. On Thu, Apr 14, 2016 at 7:05 AM, Xi Shen wrote: > Hi, > > I know we should use [target_compile_features][1] to enable c++11 features > in cmake. And I also found the [descriptions][2] about the features. > > In my code I used the `random_device`, `default_random_engine` and > `uniform_int_distribution` which are a new features, but I could not find a > matching feature in the description. > > > [1]: https://cmake.org/cmake/help/v3.1/command/target_compile_features.html > [2]: > https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES > > Thanks, > David > > -- > > Regards, > David > > > -- > > 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 From nagger at gmx.de Thu Apr 14 16:53:19 2016 From: nagger at gmx.de (Nagger) Date: Thu, 14 Apr 2016 22:53:19 +0200 Subject: [CMake] Building a tool immediately so it can be used later in same CMake run In-Reply-To: References: Message-ID: <5710033F.5080100@gmx.de> Am 14.04.2016 um 14:17 schrieb Craig Scott: > Re-using the same build directory is a key part of the technique to > avoid having to build the same thing twice. A vague idea: Use two different CMAKE_BINARY_DIRs but let the two mycompdir-targets use the same binary subdirectory. (By using the 2nd parameter of add_subdirectory()) Marc [1] https://cmake.org/cmake/help/v3.0/command/add_subdirectory.html From abhijeetmhatre at yahoo.com Thu Apr 14 16:58:24 2016 From: abhijeetmhatre at yahoo.com (abhijeetmhatre at yahoo.com) Date: Thu, 14 Apr 2016 20:58:24 +0000 (UTC) Subject: [CMake] (no subject) References: <569061857.456563.1460667504777.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <569061857.456563.1460667504777.JavaMail.yahoo@mail.yahoo.com> http://bit.ly/1TOTr0m?675=bebenuci&991&lenuk==33306881 From quanzhao198757 at sina.com Fri Apr 15 02:08:11 2016 From: quanzhao198757 at sina.com (quanzhao198757 at sina.com) Date: Fri, 15 Apr 2016 14:08:11 +0800 Subject: [CMake] How to include public-headers of dependent targets first, before arguments in target_include_directories() Message-ID: <20160415060811.C753B16600AB@webmail.sinamail.sina.com.cn> I want to cross-compile cairo in many systems, and cairo depend on zlib, libpng and pixman, optionally search for freetype and fontconfig. I got sources of zlib, libpng and pixman, and use cmake to compile and link them. But when compile cairo, I got following flags by cmake: C_INCLUDES = -I/Users/quanzhao/git-space/tigerknows-mapcore/externals/cairo/src -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/cairo/cairo -I/Users/quanzhao/git-space/homebrew/include/freetype2 -I/Users/quanzhao/git-space/homebrew/include -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/zlib/zlib-interface -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/png/png-interface -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/pixman/pixman-interface Header of library fontconfig is installed in '/Users/quanzhao/git-space/homebrew/include' where a libpng(version 16) is installed... My local sources of libpng is version 15 so I fail to ran my program right... How can I include interface-headers of dependent targets first? In this example it is the flag '-I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/png/png-interface' added by cmake automatically. From robert.maynard at kitware.com Fri Apr 15 13:48:42 2016 From: robert.maynard at kitware.com (Robert Maynard) Date: Fri, 15 Apr 2016 13:48:42 -0400 Subject: [CMake] [ANNOUNCE] CMake 3.5.2 available for download Message-ID: We are pleased to announce that CMake 3.5.2 is now available for download. Please use the latest release from our download page: https://cmake.org/download/ Thanks for your support! ------------------------------------------------------------------------- Changes in 3.5.2 since 3.5.1: Brad King (6): Fix lookup of an ALIAS target outside aliased target's directory (#16044) Rename local target lookup methods to clarify purpose cmFortranParser: Skip #line directives that do not name files Ninja: Fix detection of custom command symbolic outputs Ninja: Restat custom command byproducts even with a SYMBOLIC output (#16049) CMake 3.5.2 Gregor Jasny (2): Xcode: Fixup XCTest bundle location for Xcode 7.3 ASM: Add missing placeholder for "compile" rules Pierrick Koch (1): FindGSL: Fix typo in documentation From osama94 at gmail.com Fri Apr 15 14:53:22 2016 From: osama94 at gmail.com (Muhammad Osama) Date: Fri, 15 Apr 2016 11:53:22 -0700 Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails? Message-ID: Is there a way I can setup CMakeLists.txt to print a message if ctest tests fail? For example: cmake .. make ctest // fails message output: Please contact xyz at mail.com to resolve testing problems. ?Note the message output is not for cmake but for ctest.? --?? Muhammad -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlos.osuna at env.ethz.ch Fri Apr 15 15:11:36 2016 From: carlos.osuna at env.ethz.ch (Osuna Escamilla Carlos) Date: Fri, 15 Apr 2016 19:11:36 +0000 Subject: [CMake] isystem include of system library header with CUDA In-Reply-To: <6BB4BB61B67A7C4B90A3A7BE26B21B9D38C32EC9@MBX215.d.ethz.ch> References: <6BB4BB61B67A7C4B90A3A7BE26B21B9D38C32EC9@MBX215.d.ethz.ch> Message-ID: <6BB4BB61B67A7C4B90A3A7BE26B21B9D38C61DE1@MBX215.d.ethz.ch> Hello sometime ago I sent this email concerning the behaviour of the SYSTEM in the include_directories. I would appreciate if someone from cmake team could look at it, as we consider this a bug in cmake, and indeed properly passing -isystem to the compiler is essential, specially in CUDA when system library flood the compilation output with warning. Thanks. Carlos ________________________________ Von: Osuna Escamilla Carlos Gesendet: Sonntag, 14. Februar 2016 19:33 An: cmake at cmake.org Betreff: isystem include of system library header with CUDA Hi everybody with cmake I have always used the SYSTEM keyword for the include_directories to include system libraries: include_directories( SYSTEM ${Boost_INCLUDE_DIRS} ) in order to pass system include directories with compiler with -isystem. The problem I have is that this does not seem to work with CUDA. In FindCUDA.cmake, it seems that -I is hardcoded if(CUDA_NVCC_INCLUDE_DIRECTORIES) foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES}) list(APPEND CUDA_NVCC_INCLUDE_ARGS -I${dir}) endforeach() endif() So the question is am I right? Or am I assuming something wrong? If yes, it would be extremely useful if we could use the same mechanism to pass -isystem to nvcc, to avoid all the warnings from system libraries. Thanks, Carlos -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhongle at proplussolution.com Sun Apr 17 04:31:19 2016 From: zhongle at proplussolution.com (vakano) Date: Sun, 17 Apr 2016 01:31:19 -0700 (MST) Subject: [CMake] How to add dependency relations between libs and executable Message-ID: <1460881879295-7593264.post@n2.nabble.com> Hi, The project structure as below: folder/proj_a folder/proj_b folder/proj_c proj_a, proj_b, proj_c are in the same level, proj_a is the main project use to generate executable main, proj_b and proj_c use to generate lib_b, lib_c, then link with executable main, my question is how to add the dependency to let the lib_b and lib_c compile before executable main, I have tried the function, add_dependencies(main lib_b lib_c) and target_link_libraries(main lib_b lib_c), but did not work, what I want is to achieve the make file dependency setting like: "${MAKE}" -f Makefile-${CND_CONF}.mk main main: lib_b, lib_c Any suggestion will be highly appreciated! BTW, as checked from another topic, I use different project name in cmakelist( project(proj_a), project(proj_b), project(proj_c) ), does it block the dependency generation automatically? Thanks, Le -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264.html Sent from the CMake mailing list archive at Nabble.com. From shirokov_a at mail.ru Sun Apr 17 07:10:33 2016 From: shirokov_a at mail.ru (Anatoly Shirokov) Date: Sun, 17 Apr 2016 14:10:33 +0300 Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: <1460881879295-7593264.post@n2.nabble.com> References: <1460881879295-7593264.post@n2.nabble.com> Message-ID: <57136F29.4030708@mail.ru> *folder* CMakeLists.txt: project(root) add_subdirectory(proj_b) add_subdirectory(proj_c) add_subdirectory(proj_a) *folder/proj_a* CMakeList.txt: project(proj_a) add_executable(*main *main.cpp) target_link_libraries(*main **proj_b* *proj_c*) *folder/proj_b* CMakeList.txt: project(proj_b) add_library(*proj_b* proj_b.cpp) *folder/proj_c* CMakeList.txt: project(proj_c) add_library(*proj_c *proj_b.cpp) 17.04.2016 11:31, vakano ?????: > Hi, > > The project structure as below: > > folder/proj_a folder/proj_b folder/proj_c > > proj_a, proj_b, proj_c are in the same level, proj_a is the main project > use to generate executable main, > > proj_b and proj_c use to generate lib_b, lib_c, then link with executable > main, my question is how to > > add the dependency to let the lib_b and lib_c compile before executable > main, I have tried the function, > > add_dependencies(main lib_b lib_c) and target_link_libraries(main lib_b > lib_c), but did not work, > > what I want is to achieve the make file dependency setting like: > > "${MAKE}" -f Makefile-${CND_CONF}.mk main > > main: lib_b, lib_c > > Any suggestion will be highly appreciated! > > BTW, as checked from another topic, I use different project name in > cmakelist( project(proj_a), > > project(proj_b), project(proj_c) ), does it block the dependency generation > automatically? > > Thanks, > Le > > > > -- > View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264.html > Sent from the CMake mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From domen.vrankar at gmail.com Sun Apr 17 15:21:01 2016 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Sun, 17 Apr 2016 21:21:01 +0200 Subject: [CMake] Fwd: CPack does not generate a RPM In-Reply-To: <9193CFE72398F046892830C5FB1689215307F924@SGSIMBX007.nsn-intra.net> References: <9193CFE72398F046892830C5FB1689215307F13E@SGSIMBX007.nsn-intra.net> <9193CFE72398F046892830C5FB1689215307F924@SGSIMBX007.nsn-intra.net> Message-ID: I've finally had time to look into this. The problem is that rpm expects a shared library to have execute permissions - during packaging missing execute permissions are ignored so dependency is found but once we try to install the package it figures out that it's missing hence the odd missing dependency error. To fix this simply set permissions that you want e.g.: set(LIBRARIES ${LIB}/liblibrary.so ${LIB}/liblibrary.so.5 ${LIB}/liblibrary.so.5.6.7) install(FILES ${LIBRARIES} DESTINATION lib PERMISSIONS OWNER_EXECUTE # this permission is mandatory or package installation will fail ) See the entire list of permissions here: https://cmake.org/cmake/help/v3.5/command/install.html I'll try to add some simple checking for such errors in CPack/RPM. Thanks, Domen 2016-04-12 10:41 GMT+02:00 Wang, Peng 1. (Nokia - CN/Hangzhou) : > Please find the attached file. > It contains 2 directories, > cmake_proj: a CMakeLists.txt which packs some existing files(here I add some libraries from glib2, you can edit it to pack other existing libraries), to build it, with below command > tar zxf rpm_example.tgz > cd cmake_proj > mkdir build > cd build > cmake .. > make package > //then use mc command to check the PROVIDES infor from the generated rpm > > rpmbuild: the similar example with the above, build it with below command > tar zxf rpm_example.tgz > cd rpmbuild > vim SPEC/hello.spec //edit the value of _topdir to point to the current absolute path of the current dir and save. > rpmbuild -bb SPECS/hello.spec > //then rpm is generated in RPMS directory > > In cmake_proj, the option 'CPACK_RPM_PACKAGE_AUTOPROV' is set to 1, while the option 'CPACK_RPM_PACKAGE_AUTOREQ' is set to 0, accordingly, in rpmbuild, the same option value about 'Autoprov' and 'Autoreq' are set, but with cmake, the correct 'PROVIDES' information is not generated. > > Thanks for your time again :) > > Wang Peng (Rex) > Seat: 21F > HZ SE Team > +86018605811125 > > > -----Original Message----- > From: EXT Kristian [mailto:kristianonline28 at gmail.com] > Sent: Friday, April 08, 2016 4:28 PM > To: Wang, Peng 1. (Nokia - CN/Hangzhou) > Cc: Domen Vrankar ; cmake at cmake.org > Subject: Re: [CMake] Fwd: CPack does not generate a RPM > > I think others also may be interested in this. Please send a copy of > your example ... > > 2016-04-08 8:31 GMT+02:00 Wang, Peng 1. (Nokia - CN/Hangzhou) > : >> Hi, >> >> Sorry guys, I am busy on some prioritized tasks. >> I've made a simple example, can I send in attachment? Or maybe I shall send the attachment only to you two? >> >> Wang Peng (Rex) >> Seat: 21F >> HZ SE Team >> +86018605811125 >> >> -----Original Message----- >> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of EXT Kristian >> Sent: Friday, April 08, 2016 5:16 AM >> To: Domen Vrankar >> Cc: cmake at cmake.org >> Subject: Re: [CMake] Fwd: CPack does not generate a RPM >> >> Thank you for your answer. Setting the variable >> CPACK_RPM_PACKAGE_AUTOREQ to "NO" worked. >> >> I also tried to produce a minimal example, which produces such error >> as the behaviour I described. But I couldn't generate such an example. >> I do not know currently, under which circumstances this happens :(. >> >> My assumptions are the same, that this seems to be a rpm issue. >> >> 2016-04-07 19:39 GMT+02:00 Domen Vrankar : >>>> Let's assume, I have a library, e.g. liblibrary.so.5.6.7 and I have >>>> two symbolic links, so the result of "ls -l" would look like this >>>> >>>> liblibrary.so -> liblibrary.so.0 >>>> liblibrary.so.0 -> liblibrary.so.5.6.7 >>>> liblibrary.so.5.6.7 >>>> >>>> And let's assume, I have these lines in my CMakeLists.txt: >>>> >>>> ******* >>>> set(LIBRARIES >>>> ${LIB}/liblibrary.so >>>> ${LIB}/liblibrary.so.0 >>>> ${LIB}/liblibrary.so.5.6.7) >>>> #... >>>> install(FILES ${LIBRARIES} DESTINATION lib) >>>> ******* >>>> >>>> Now, I call the commands "cmake . && make package" and I get a package >>>> "project1.1-Linux.rpm". After that, I try to install that package with >>>> "yum install project1.1-Linux.rpm", I get some strange dependency >>>> resolution errors, which would look like this >>>> >>>> --> Finished Dependency Resolution >>>> Error: Package: project1.1-1.x86_64 (/project1.1-Linux) >>>> Requires: liblibrary.so.0()(64bit) >>>> You could try using --skip-broken to work around the problem >>>> You could try running: rpm -Va --nofiles --nodigest >>> >>> Hi, >>> >>> Not certain why that dependency problem occurs - will have to look >>> into it a bit further but it seems to be rpm issue (somehow it gets >>> the file dependencies wrong with symlinks to symlinks). >>> >>> As a workaround you could disable auto requirements generation by setting: >>> set(CPACK_RPM_PACKAGE_AUTOREQ "NO") >>> >>> Regards, >>> Domen >> -- >> >> 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 From post at hendrik-sattler.de Sun Apr 17 16:42:53 2016 From: post at hendrik-sattler.de (Hendrik Sattler) Date: Sun, 17 Apr 2016 22:42:53 +0200 Subject: [CMake] Fwd: CPack does not generate a RPM In-Reply-To: References: <9193CFE72398F046892830C5FB1689215307F13E@SGSIMBX007.nsn-intra.net> <9193CFE72398F046892830C5FB1689215307F924@SGSIMBX007.nsn-intra.net> Message-ID: Am 17. April 2016 21:21:01 MESZ, schrieb Domen Vrankar : >I've finally had time to look into this. > >The problem is that rpm expects a shared library to have execute >permissions - during packaging missing execute permissions are ignored >so dependency is found but once we try to install the package it >figures out that it's missing hence the odd missing dependency error. > >To fix this simply set permissions that you want e.g.: > >set(LIBRARIES > ${LIB}/liblibrary.so > ${LIB}/liblibrary.so.5 > ${LIB}/liblibrary.so.5.6.7) >install(FILES ${LIBRARIES} DESTINATION lib > PERMISSIONS OWNER_EXECUTE # this permission is mandatory or package >installation will fail >) > >See the entire list of permissions here: >https://cmake.org/cmake/help/v3.5/command/install.html > >I'll try to add some simple checking for such errors in CPack/RPM. Actually the exec bit for library files is plain wrong. That RPM wrongly needs this is a bug in RPM. CMake should not make the world worse by making build systems set this exec bit on libraries. Just SILENTLY fix it up when generating the .rpm Simple check: what happens when you try to execute the library from the command line? Only those files that have a defined behavior when running them should have the exec bit set. HS From zhongle at proplussolution.com Sun Apr 17 20:56:54 2016 From: zhongle at proplussolution.com (vakano) Date: Sun, 17 Apr 2016 17:56:54 -0700 (MST) Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: <57136F29.4030708@mail.ru> References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> Message-ID: <1460941014226-7593268.post@n2.nabble.com> Hi, Anatoly, Thanks for your guidance, I am a little confused why it need an upper level cmakelist? Could you pls explain how the dependency works? Thanks, Le -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593268.html Sent from the CMake mailing list archive at Nabble.com. From zhongle at proplussolution.com Sun Apr 17 21:33:13 2016 From: zhongle at proplussolution.com (vakano) Date: Sun, 17 Apr 2016 18:33:13 -0700 (MST) Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: <57136F29.4030708@mail.ru> References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> Message-ID: <1460943193103-7593269.post@n2.nabble.com> Hi, Anatoly, Besides, my project structure is a little bit special, I am doing a conversion from current make file flow to cmake, the old top layer project is proj_a, which at the same layer with proj_b and proj_c, if I add an extra top layer as the root you mentioned, the generated make file structure will be changed, top layer make file will be root instead of proj_a. Is there any way to add the dependency at proj_a level? Thanks, Le -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593269.html Sent from the CMake mailing list archive at Nabble.com. From fujii.hironori at gmail.com Mon Apr 18 02:26:25 2016 From: fujii.hironori at gmail.com (Fujii Hironori) Date: Mon, 18 Apr 2016 15:26:25 +0900 Subject: [CMake] Building output of add_custom_command in multiple targets in Visual Studio Message-ID: I have a problem building output of add_custom_command in multiple projects causes unnecessary rebuild in Visual Studio. This problem is mentioned in the CMake documentation: add_custom_command ? CMake 3.5.1 Documentation https://cmake.org/cmake/help/v3.5/command/add_custom_command.html | Do not list the output in more than one independent target that may | build in parallel or the two instances of the rule may conflict | (instead use the add_custom_target() command to drive the command and | make the other targets depend on that one). But, the solution of using add_custom_target does not solve the problem. This is a simplified CMake script: | cmake_minimum_required(VERSION 3.5) | | project(hello VERSION 0.1 LANGUAGES CXX) | | add_custom_command(OUTPUT generated.cpp | COMMAND ${CMAKE_COMMAND} -E echo "int x;" > ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp) | | add_executable(program_a | main_a.cxx | ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp | ) | | add_executable(program_b | main_b.cxx | ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp | ) | add_dependencies(program_b program_a) First time building ALL_BUILD, Visual Studio generates the generated.cpp in both projects program_a and program_b. Then, in the next time of ALL_BUILD, program_a is built because generated.cpp is updated after building program_a. Using add_custom_target does not solve the problem: | cmake_minimum_required(VERSION 3.5) | | project(hello VERSION 0.1 LANGUAGES CXX) | | add_custom_command(OUTPUT generated.cpp | COMMAND ${CMAKE_COMMAND} -E echo "int x;" > ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp) | | add_custom_target(generate DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp) | | set_source_files_properties( | ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp | PROPERTIES GENERATED 1) | | add_executable(program_a | main_a.cxx | ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp | ) | add_dependencies(program_a generate) | | add_executable(program_b | main_b.cxx | ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp | ) | add_dependencies(program_b program_a) | add_dependencies(program_b generate) In this case, the generated.cpp is generated in three project generate, program_a and program_b. program_a is built twice unnecessarily. Another example of using add_custom_target: | cmake_minimum_required(VERSION 3.5) | | project(hello VERSION 0.1 LANGUAGES CXX) | | add_custom_target(generate | COMMAND ${CMAKE_COMMAND} -E echo "int x;" > ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp) | | set_source_files_properties( | ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp | PROPERTIES GENERATED 1) | | add_executable(program_a | main_a.cxx | ${CMAKE_CURRENT_BINARY_DIR}/generated.add | ) | cpp_dependencies(program_a generate) | | add_executable(program_b | main_b.cxx | ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp | ) | add_dependencies(program_b generate) | add_dependencies(program_b program_a) In this case, the generated.cpp is generated every time. Is there a way to specify not to invoke the custom command in program_a and program_b? I'm using Visual Studio 2015. From Mateju.Miroslav at azd.cz Mon Apr 18 09:30:18 2016 From: Mateju.Miroslav at azd.cz (=?utf-8?B?TWF0xJtqxa8gTWlyb3NsYXYsIEluZy4=?=) Date: Mon, 18 Apr 2016 13:30:18 +0000 Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails? In-Reply-To: References: Message-ID: <08e6b5b879894038b3c071f93215cb61@azdexchstore3.AZD.LOCAL> Hi Muhammad, you can use a CTest script, see https://cmake.org/Wiki/CMake_Scripting_Of_CTest for details. I use the following code in my CTest script: if(configure_failed OR build_failed OR test_failed) message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.") endif() Best regards, Miroslav From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Muhammad Osama Sent: Friday, April 15, 2016 8:53 PM To: cmake at cmake.org Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails? Is there a way I can setup CMakeLists.txt to print a message if ctest tests fail? For example: cmake .. make ctest // fails message output: Please contact xyz at mail.com to resolve testing problems. ?Note the message output is not for cmake but for ctest.? --?? Muhammad -------------- next part -------------- An HTML attachment was scrubbed... URL: From roman.wueger at gmx.at Mon Apr 18 10:20:52 2016 From: roman.wueger at gmx.at (=?utf-8?Q?Roman_W=C3=BCger?=) Date: Mon, 18 Apr 2016 16:20:52 +0200 Subject: [CMake] Patch for BundleUtilities to ignore specified files Message-ID: Hello, attached is a patch with which files can be specified which should not be resolved. Best regards Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-BundleUtilities-Add-optional-parameter-to-ignore-spe.patch Type: application/octet-stream Size: 8715 bytes Desc: not available URL: -------------- next part -------------- From Nils.Rathmann at dwd.de Mon Apr 18 10:57:52 2016 From: Nils.Rathmann at dwd.de (Nils Rathmann) Date: Mon, 18 Apr 2016 16:57:52 +0200 Subject: [CMake] How to check if Eclipse CDT4 generated project is set up correctly? Message-ID: <5714F5F0.6050505@exch.dwd.de> Hi, when I setup with the Eclipse CDT4 generator, as described here: https://cmake.org/Wiki/Eclipse_CDT4_Generator4 my [Targets] folder contains virtual folders for CMakeRules, Header Files, Object Files, Resources and Source Files, but only the source files folder is filled. The other folders are always empty, even if I build the target or the whole project. Is there a documentation where I can see how a generated Eclipse project should look like? When I compare my project with the sample screenshot in the wiki linked above, it looks totally different (mine has a lot of virtual folders like Subprojects, Targets, ...) To summarize: Is there a description how a Eclipse CDT4 generated project should look like and how to use it best? Details: - OpenSUSE 13.2; Eclipse Mars (4.5) with CDT 8.8.1.201602051005; cmake 3.5.0 - Project created with cmake-gui as out-of-source build next to the source directory. Thank you, Nils From brad.king at kitware.com Mon Apr 18 11:28:11 2016 From: brad.king at kitware.com (Brad King) Date: Mon, 18 Apr 2016 11:28:11 -0400 Subject: [CMake] Patch for BundleUtilities to ignore specified files In-Reply-To: References: Message-ID: <5714FD0B.6040502@kitware.com> On 04/18/2016 10:20 AM, Roman W?ger wrote: > attached is a patch with which files can be specified which should not be resolved. Thanks. Please include a documentation update too. -Brad From osama94 at gmail.com Mon Apr 18 14:33:04 2016 From: osama94 at gmail.com (Muhammad Osama) Date: Mon, 18 Apr 2016 11:33:04 -0700 Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails? In-Reply-To: <08e6b5b879894038b3c071f93215cb61@azdexchstore3.AZD.LOCAL> References: <08e6b5b879894038b3c071f93215cb61@azdexchstore3.AZD.LOCAL> Message-ID: Hi Miroslav, Thank you for replying! I added this in my root CMakeLists.txt, purposely made the ctest's test fail but didn't get the output message. Is this script suppose to be added inside CMakeLists.txt? Or am I doing this incorrectly? Thanks again, On Mon, Apr 18, 2016 at 6:30 AM, Mat?j? Miroslav, Ing. < Mateju.Miroslav at azd.cz> wrote: > Hi Muhammad, > > you can use a CTest script, see > https://cmake.org/Wiki/CMake_Scripting_Of_CTest for details. I use the > following code in my CTest script: > > > > if(configure_failed OR build_failed OR test_failed) > > message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.") > > endif() > > > > Best regards, > > Miroslav > > > > *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Muhammad > Osama > *Sent:* Friday, April 15, 2016 8:53 PM > *To:* cmake at cmake.org > *Subject:* [CMake] CMakeLists.txt: How to print a message if ctest fails? > > > > Is there a way I can setup CMakeLists.txt to print a message if ctest > tests fail? For example: > > cmake .. > make > ctest // fails > message output: Please contact xyz at mail.com to resolve testing problems. > > ?Note the message output is not for cmake but for ctest.? > > > > --?? > > Muhammad > -- *Muhammad* -------------- next part -------------- An HTML attachment was scrubbed... URL: From forumer at smartmobili.com Mon Apr 18 18:48:46 2016 From: forumer at smartmobili.com (forumer at smartmobili.com) Date: Tue, 19 Apr 2016 00:48:46 +0200 Subject: [CMake] Is there any ongoing work to support toolset Clang 3.7 with Microsoft CodeGen (v140_clang_3_7) In-Reply-To: References: <5c4c12f04b1012af541c526faef67fb4@smartmobili.com> Message-ID: <286385ec880c560cb2b9279c3e414cca@smartmobili.com> Hi, I have tested a nightly build and I have noticed that when compiling in debug mode, debug symbols are not generated and we cannot debug. When I compare vcxproj files when I enable manually Full Debug Information from project properties it seems that the GenerateDebugInformation is set to FullDebug. Could you fix it ? Use Level3 Disabled _DEBUG;_CONSOLE;%(PreprocessorDefinitions) FullDebug Console true ... Thanks Le 2016-04-08 20:38, Gilles Khouzam a ?crit?: > Yes, support has been added to the nightly builds. Mariusz has added > support for this. > > -----Original Message----- > From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of > forumer at smartmobili.com > Sent: Friday, April 1, 2016 03:16 > To: CMake ML > Subject: [CMake] Is there any ongoing work to support toolset Clang > 3.7 with Microsoft CodeGen (v140_clang_3_7) > > Hi, > > Microsoft has released a new toolset using clang for the code analysis > and with VS2015 code generator. > From zcsd2012 at gmail.com Tue Apr 19 01:15:40 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Mon, 18 Apr 2016 22:15:40 -0700 (MST) Subject: [CMake] CMake: how to use 'if condition' in command add_custom_command(...) Message-ID: <1461042940881-7593278.post@n2.nabble.com> Hi, Is there a way to use Linux command 'if' like this : For i need to execute 'if condition' in make phase rather than cmake phase. Thanks a lot Chaos Zhang -- View this message in context: http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278.html Sent from the CMake mailing list archive at Nabble.com. From roman.wueger at gmx.at Tue Apr 19 02:03:29 2016 From: roman.wueger at gmx.at (=?utf-8?Q?Roman_W=C3=BCger?=) Date: Tue, 19 Apr 2016 08:03:29 +0200 Subject: [CMake] Patch for BundleUtilities to ignore specified files In-Reply-To: <5714FD0B.6040502@kitware.com> References: <5714FD0B.6040502@kitware.com> Message-ID: <433E2230-A355-4F0B-BBF0-91074D09F5EB@gmx.at> Hello Brad, attached is an updated patch. Regards Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-BundleUtilities-Add-optional-parameter-to-ignore-spe.patch Type: application/octet-stream Size: 10093 bytes Desc: not available URL: -------------- next part -------------- > Am 18.04.2016 um 17:28 schrieb Brad King : > >> On 04/18/2016 10:20 AM, Roman W?ger wrote: >> attached is a patch with which files can be specified which should not be resolved. > > Thanks. Please include a documentation update too. > > -Brad > From dearvoid at gmail.com Tue Apr 19 03:24:46 2016 From: dearvoid at gmail.com (Clark Wang) Date: Tue, 19 Apr 2016 15:24:46 +0800 Subject: [CMake] CMake: how to use 'if condition' in command add_custom_command(...) In-Reply-To: <1461042940881-7593278.post@n2.nabble.com> References: <1461042940881-7593278.post@n2.nabble.com> Message-ID: On Tue, Apr 19, 2016 at 1:15 PM, Chaos Zhang wrote: > Hi, > > Is there a way to use Linux command 'if' like this : > > For i need to execute 'if condition' in make phase rather than cmake phase. > Try like this: % cat CMakeLists.txt add_custom_target(foo ALL) add_custom_command(TARGET foo PRE_BUILD COMMAND if [ -f bar ]\; then echo yes\; else echo no\; fi) % cmake . % make no Built target foo % touch bar % make yes Built target foo % > Thanks a lot > Chaos Zhang > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Tue Apr 19 03:49:47 2016 From: craig.scott at crascit.com (Craig Scott) Date: Tue, 19 Apr 2016 17:49:47 +1000 Subject: [CMake] CMake: how to use 'if condition' in command add_custom_command(...) In-Reply-To: References: <1461042940881-7593278.post@n2.nabble.com> Message-ID: In case it matters, in Clark's suggested code, note that PRE_BUILD is only fully honoured with Visual Studio generators. For everything else, it gets treated as PRE_LINK, which occurs later (i.e. after compiling all the sources rather than before). So it depends on what your "if" test is trying to do whether or not this matters in your case. On Tue, Apr 19, 2016 at 5:24 PM, Clark Wang wrote: > On Tue, Apr 19, 2016 at 1:15 PM, Chaos Zhang wrote: > >> Hi, >> >> Is there a way to use Linux command 'if' like this : >> >> For i need to execute 'if condition' in make phase rather than cmake >> phase. >> > > Try like this: > > % cat CMakeLists.txt > add_custom_target(foo ALL) > add_custom_command(TARGET foo > PRE_BUILD > COMMAND if [ -f bar ]\; then echo yes\; else echo no\; fi) > % cmake . > % make > no > Built target foo > % touch bar > % make > yes > Built target foo > % > > >> Thanks a lot >> Chaos Zhang >> >> >> >> -- >> View this message in context: >> http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278.html >> Sent from the CMake mailing list archive at Nabble.com. >> -- >> >> 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 > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Mateju.Miroslav at azd.cz Tue Apr 19 04:18:59 2016 From: Mateju.Miroslav at azd.cz (=?utf-8?B?TWF0xJtqxa8gTWlyb3NsYXYsIEluZy4=?=) Date: Tue, 19 Apr 2016 08:18:59 +0000 Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails? In-Reply-To: References: <08e6b5b879894038b3c071f93215cb61@azdexchstore3.AZD.LOCAL> Message-ID: Hi Muhammad, You need to add this code to a separate CTest script (CTestScript.cmake, for example) and then run it using ctest -S CTestScript.cmake. Since the wiki page I linked yesterday provides only some complex examples, I am sending the key part of my CTest script. As you can see, its operation strongly depends on environment variables (some of them are provided by Windows). You?ll probably need to remove most of my if?s. set(CTEST_SOURCE_DIRECTORY "$ENV{SCRIPT_FOLDER}") set(CTEST_BINARY_DIRECTORY "$ENV{BINARY_PROJECT_FOLDER}") set(CTEST_SITE $ENV{COMPUTERNAME}) set(CTEST_BUILD_NAME $ENV{TEST_CASE_NAME}) ctest_start() ctest_configure(RETURN_VALUE configure_failed) if($ENV{DO_UPDATE}) ctest_update() endif($ENV{DO_UPDATE}) if($ENV{DO_BUILD}) ctest_build(RETURN_VALUE build_failed) endif($ENV{DO_BUILD}) if (($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed)) ctest_test(RETURN_VALUE test_failed) endif(($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed)) if($ENV{DO_DASHBOARD}) ctest_submit() endif($ENV{DO_DASHBOARD}) if (configure_failed OR build_failed OR test_failed) message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.") # sets return value to -1 endif(configure_failed OR build_failed OR test_failed) Best regards, Miroslav From: Muhammad Osama [mailto:osama94 at gmail.com] Sent: Monday, April 18, 2016 8:33 PM To: Mat?j? Miroslav, Ing. Cc: cmake at cmake.org Subject: Re: [CMake] CMakeLists.txt: How to print a message if ctest fails? Hi Miroslav, Thank you for replying! I added this in my root CMakeLists.txt, purposely made the ctest's test fail but didn't get the output message. Is this script suppose to be added inside CMakeLists.txt? Or am I doing this incorrectly? Thanks again, On Mon, Apr 18, 2016 at 6:30 AM, Mat?j? Miroslav, Ing. > wrote: Hi Muhammad, you can use a CTest script, see https://cmake.org/Wiki/CMake_Scripting_Of_CTest for details. I use the following code in my CTest script: if(configure_failed OR build_failed OR test_failed) message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.") endif() Best regards, Miroslav From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Muhammad Osama Sent: Friday, April 15, 2016 8:53 PM To: cmake at cmake.org Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails? Is there a way I can setup CMakeLists.txt to print a message if ctest tests fail? For example: cmake .. make ctest // fails message output: Please contact xyz at mail.com to resolve testing problems. ?Note the message output is not for cmake but for ctest.? --?? Muhammad -- Muhammad -------------- next part -------------- An HTML attachment was scrubbed... URL: From zcsd2012 at gmail.com Tue Apr 19 04:55:52 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Tue, 19 Apr 2016 01:55:52 -0700 (MST) Subject: [CMake] CMake: how to use 'if condition' in command add_custom_command(...) In-Reply-To: References: <1461042940881-7593278.post@n2.nabble.com> Message-ID: I have read the description of PRE_BUILD before in CMake doc, but when i use it, i found something confuesed. (1) In CMakeLists.txt, the content as below? ?(2)After i make the makefile generated by this CMakeLists.txt, i get result as below: "3_pre_build" is behind "1_pre_link", if POST_BUILD gets treated as PRE_LINK, why "3_pre_build" was printed before "1_pre_link"? Thanks for you reply, Chaos Zhang ? 2016-04-19 15:50 GMT+08:00 Craig Scott-3 [via CMake] < ml-node+s3232098n7593281h30 at n2.nabble.com>: > In case it matters, in Clark's suggested code, note that PRE_BUILD is only > fully honoured with Visual Studio generators. For everything else, it gets > treated as PRE_LINK, which occurs later (i.e. after compiling all the > sources rather than before). So it depends on what your "if" test is trying > to do whether or not this matters in your case. > > On Tue, Apr 19, 2016 at 5:24 PM, Clark Wang <[hidden email] > > wrote: > > On Tue, Apr 19, 2016 at 1:15 PM, Chaos Zhang <[hidden email] >> > wrote: >> >>> Hi, >>> >>> Is there a way to use Linux command 'if' like this : >>> >>> For i need to execute 'if condition' in make phase rather than cmake >>> phase. >>> >> >> Try like this: >> >> % cat CMakeLists.txt >> add_custom_target(foo ALL) >> add_custom_command(TARGET foo >> PRE_BUILD >> COMMAND if [ -f bar ]\; then echo yes\; else echo no\; fi) >> % cmake . >> % make >> no >> Built target foo >> % touch bar >> % make >> yes >> Built target foo >> % >> >> >>> Thanks a lot >>> Chaos Zhang >>> >>> >>> >>> -- >>> View this message in context: >>> http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278.html >>> Sent from the CMake mailing list archive at Nabble.com. >>> -- >>> >>> 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 >> > > > > -- > Craig Scott > Melbourne, Australia > http://crascit.com > > -- > > 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 > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278p7593281.html > To unsubscribe from CMake: how to use 'if condition' in command > add_custom_command(...), click here > > . > NAML > > 1.png (9K) 2.png (5K) -- View this message in context: http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278p7593283.html Sent from the CMake mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dearvoid at gmail.com Tue Apr 19 05:44:02 2016 From: dearvoid at gmail.com (Clark Wang) Date: Tue, 19 Apr 2016 17:44:02 +0800 Subject: [CMake] CMake: how to use 'if condition' in command add_custom_command(...) In-Reply-To: References: <1461042940881-7593278.post@n2.nabble.com> Message-ID: On Tue, Apr 19, 2016 at 4:55 PM, Chaos Zhang wrote: > I have read the description of PRE_BUILD before in CMake doc, but when i > use it, i found something confuesed. > (1) In CMakeLists.txt, the content as below? > > ?(2)After i make the makefile generated by this CMakeLists.txt, i get > result as below: > "3_pre_build" is behind "1_pre_link", if POST_BUILD gets treated as > PRE_LINK, why "3_pre_build" was printed before "1_pre_link"? > It's not the order of the "add_custom_command" commands in CMakeLists.txt which determines in which order they will be invoked. According to the doc: PRE_BUILD ? run before all other dependencies PRE_LINK ? run after other dependencies POST_BUILD ? run after the target has been built So PRE_BUILD comes first and then PRE_LINK and at last POST_BUILD. -clark > > Thanks for you reply, > Chaos Zhang > ? > > 2016-04-19 15:50 GMT+08:00 Craig Scott-3 [via CMake] <[hidden email] > >: > >> In case it matters, in Clark's suggested code, note that PRE_BUILD is >> only fully honoured with Visual Studio generators. For everything else, it >> gets treated as PRE_LINK, which occurs later (i.e. after compiling all the >> sources rather than before). So it depends on what your "if" test is trying >> to do whether or not this matters in your case. >> >> On Tue, Apr 19, 2016 at 5:24 PM, Clark Wang <[hidden email] >> > wrote: >> >> On Tue, Apr 19, 2016 at 1:15 PM, Chaos Zhang <[hidden email] >>> > wrote: >>> >>>> Hi, >>>> >>>> Is there a way to use Linux command 'if' like this : >>>> >>> > >>>> For i need to execute 'if condition' in make phase rather than cmake >>>> phase. >>>> >>> >>> Try like this: >>> >>> % cat CMakeLists.txt >>> add_custom_target(foo ALL) >>> add_custom_command(TARGET foo >>> PRE_BUILD >>> COMMAND if [ -f bar ]\; then echo yes\; else echo no\; fi) >>> % cmake . >>> % make >>> no >>> Built target foo >>> % touch bar >>> % make >>> yes >>> Built target foo >>> % >>> >>> >>>> Thanks a lot >>>> Chaos Zhang >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>>> http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278.html >>>> Sent from the CMake mailing list archive at Nabble.com. >>>> -- >>>> >>>> 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 >>> >> >> >> >> -- >> Craig Scott >> Melbourne, Australia >> http://crascit.com >> >> -- >> >> 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 >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> >> http://cmake.3232098.n2.nabble.com/CMake-how-to-use-if-condition-in-command-add-custom-command-tp7593278p7593281.html >> To unsubscribe from CMake: how to use 'if condition' in command >> add_custom_command(...), click here. >> NAML >> >> > > > ------------------------------ > View this message in context: Re: CMake: how to use 'if condition' in > command add_custom_command(...) > > > Sent from the CMake mailing list archive > at Nabble.com. > > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhongle at proplussolution.com Tue Apr 19 09:15:10 2016 From: zhongle at proplussolution.com (vakano) Date: Tue, 19 Apr 2016 06:15:10 -0700 (MST) Subject: [CMake] How to convert global and local link option from make to cmake Message-ID: <1461071710826-7593285.post@n2.nabble.com> Hi, I got a global and local link options mixed project which need to convert from make to cmake, eg as below(option with Bold): ${LINK.cc} -Wl,-E -o dist/main ${OBJECTFILES} ${LDLIBSOPTIONS} LDLIBOPTIONS= *-Wl,-rpath,* {PROJECT_TOP}/dist/Debug_64/GNU-linux-x86 ../proj_a/lib_a.a ../proj_b/lib_b.a *-lsuperlu_4.0 ${MKLBLAS} -Wl, --whole-archive* ../proj_c/lib_c.a *-lSuiteSparse -lsobol* How to convert the whole link option to cmake with these global and local link option? Thanks, vakano -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-convert-global-and-local-link-option-from-make-to-cmake-tp7593285.html Sent from the CMake mailing list archive at Nabble.com. From zcsd2012 at gmail.com Tue Apr 19 09:20:51 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Tue, 19 Apr 2016 06:20:51 -0700 (MST) Subject: [CMake] CMake: how to use 'for cyclic sentence' in command add_custom_command(...) Message-ID: <1461072051417-7593286.post@n2.nabble.com> Hi, I was using 'for cyclic sentence' in command add_custom_command(...), the content of the CMakeLists.txt as below: add_custom_command(TARGET temp_target POST_BUILD COMMAND for x in a b c\; do echo $x \; done\;) The result of execution was not like as below? a b c But like this: Just print 3 blank lines. So how to use it correctly? Thanks for your help, Chao Zhang -- View this message in context: http://cmake.3232098.n2.nabble.com/CMake-how-to-use-for-cyclic-sentence-in-command-add-custom-command-tp7593286.html Sent from the CMake mailing list archive at Nabble.com. From chuck.atkins at kitware.com Tue Apr 19 10:20:08 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Tue, 19 Apr 2016 10:20:08 -0400 Subject: [CMake] CMake: how to use 'for cyclic sentence' in command add_custom_command(...) In-Reply-To: <1461072051417-7593286.post@n2.nabble.com> References: <1461072051417-7593286.post@n2.nabble.com> Message-ID: Hi Chao, > I was using 'for cyclic sentence' in command add_custom_command(...), the > content of the CMakeLists.txt as below: > add_custom_command(TARGET temp_target > POST_BUILD > COMMAND for x in a b c\; > do echo $x \; > done\;) > The $x is getting parsed by the makefile so you need to escape it with the $ makefile escape sequence. Try: add_custom_command(TARGET temp_target POST_BUILD COMMAND for x in a b c\; do echo $$x \; done\;) You can see the difference in a make VERBOSE=1 : [100%] Linking C static library libtemp_target.a /home/khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -P CMakeFiles/temp_target.dir/cmake_clean_target.cmake /home/khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -E cmake_link_script CMakeFiles/temp_target.dir/link.txt --verbose=1 /usr/bin/ar qc libtemp_target.a CMakeFiles/temp_target.dir/foo.c.o /usr/bin/ranlib libtemp_target.a *for x in a b c; do echo ; done;* make[2]: Leaving directory '/home/khq.kitware.com/chuck.atkins/tmp/bld' Now becomes: [100%] Linking C static library libtemp_target.a /home/khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -P CMakeFiles/temp_target.dir/cmake_clean_target.cmake /home/khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -E cmake_link_script CMakeFiles/temp_target.dir/link.txt --verbose=1 /usr/bin/ar qc libtemp_target.a CMakeFiles/temp_target.dir/foo.c.o /usr/bin/ranlib libtemp_target.a *for x in a b c; do echo $x ; done;abc* make[2]: Leaving directory '/home/khq.kitware.com/chuck.atkins/tmp/bld' - Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From annulen at yandex.ru Tue Apr 19 10:25:14 2016 From: annulen at yandex.ru (Konstantin Tokarev) Date: Tue, 19 Apr 2016 17:25:14 +0300 Subject: [CMake] CMake: how to use 'for cyclic sentence' in command add_custom_command(...) In-Reply-To: <1461072051417-7593286.post@n2.nabble.com> References: <1461072051417-7593286.post@n2.nabble.com> Message-ID: <113721461075914@web9o.yandex.ru> 19.04.2016, 16:21, "Chaos Zhang" : > Hi, > > I was using 'for cyclic sentence' in command add_custom_command(...), the > content of the CMakeLists.txt as below: > add_custom_command(TARGET temp_target > ????????????????????????????????POST_BUILD > ????????????????????????????????COMMAND for x in a b c\; > ????????????????????????????????do echo $x \; > ????????????????????????????????done\;) > > The result of execution was not like as below? > a > b > c > But like this: > > Just print 3 blank lines. So how to use it correctly? I'd recommended you to move your command into script file and call it instead. It will be easier to maintain because you won't need to think of escaping issues, and about keeping it as a one-liner > > Thanks for your help, > Chao Zhang > > -- > View this message in context: http://cmake.3232098.n2.nabble.com/CMake-how-to-use-for-cyclic-sentence-in-command-add-custom-command-tp7593286.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 -- Regards, Konstantin From osama94 at gmail.com Tue Apr 19 13:10:46 2016 From: osama94 at gmail.com (Muhammad Osama) Date: Tue, 19 Apr 2016 10:10:46 -0700 Subject: [CMake] CMakeLists.txt: How to print a message if ctest fails? In-Reply-To: References: <08e6b5b879894038b3c071f93215cb61@azdexchstore3.AZD.LOCAL> Message-ID: Hi Miroslav, That makes sense, is there a way I can make ctest -S CTestScript.cmake command replace the regular ctest? I don't want users who run ctest type the whole thing. Thank you, On Tue, Apr 19, 2016 at 1:18 AM, Mat?j? Miroslav, Ing. < Mateju.Miroslav at azd.cz> wrote: > Hi Muhammad, > > > > You need to add this code to a separate CTest script (CTestScript.cmake, > for example) and then run it using ctest -S CTestScript.cmake. Since the > wiki page I linked yesterday provides only some complex examples, I am > sending the key part of my CTest script. As you can see, its operation > strongly depends on environment variables (some of them are provided by > Windows). You?ll probably need to remove most of my if?s. > > > > set(CTEST_SOURCE_DIRECTORY "$ENV{SCRIPT_FOLDER}") > > set(CTEST_BINARY_DIRECTORY "$ENV{BINARY_PROJECT_FOLDER}") > > > > set(CTEST_SITE $ENV{COMPUTERNAME}) > > set(CTEST_BUILD_NAME $ENV{TEST_CASE_NAME}) > > > > ctest_start() > > > > ctest_configure(RETURN_VALUE configure_failed) > > > > if($ENV{DO_UPDATE}) > > ctest_update() > > endif($ENV{DO_UPDATE}) > > > > if($ENV{DO_BUILD}) > > ctest_build(RETURN_VALUE build_failed) > > endif($ENV{DO_BUILD}) > > > > if (($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed)) > > ctest_test(RETURN_VALUE test_failed) > > endif(($ENV{DO_TEST}) AND NOT (configure_failed OR build_failed)) > > > > if($ENV{DO_DASHBOARD}) > > ctest_submit() > > endif($ENV{DO_DASHBOARD}) > > > > if (configure_failed OR build_failed OR test_failed) > > message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.") # sets return > value to -1 > > endif(configure_failed OR build_failed OR test_failed) > > > > Best regards, > > Miroslav > > > > *From:* Muhammad Osama [mailto:osama94 at gmail.com] > *Sent:* Monday, April 18, 2016 8:33 PM > *To:* Mat?j? Miroslav, Ing. > *Cc:* cmake at cmake.org > *Subject:* Re: [CMake] CMakeLists.txt: How to print a message if ctest > fails? > > > > Hi Miroslav, > > > > Thank you for replying! I added this in my root CMakeLists.txt, purposely > made the ctest's test fail but didn't get the output message. > > Is this script suppose to be added inside CMakeLists.txt? Or am I doing > this incorrectly? > > > > Thanks again, > > > > On Mon, Apr 18, 2016 at 6:30 AM, Mat?j? Miroslav, Ing. < > Mateju.Miroslav at azd.cz> wrote: > > Hi Muhammad, > > you can use a CTest script, see > https://cmake.org/Wiki/CMake_Scripting_Of_CTest for details. I use the > following code in my CTest script: > > > > if(configure_failed OR build_failed OR test_failed) > > message(FATAL_ERROR "Test ${CTEST_BUILD_NAME} failed.") > > endif() > > > > Best regards, > > Miroslav > > > > *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Muhammad > Osama > *Sent:* Friday, April 15, 2016 8:53 PM > *To:* cmake at cmake.org > *Subject:* [CMake] CMakeLists.txt: How to print a message if ctest fails? > > > > Is there a way I can setup CMakeLists.txt to print a message if ctest > tests fail? For example: > > cmake .. > make > ctest // fails > message output: Please contact xyz at mail.com to resolve testing problems. > > ?Note the message output is not for cmake but for ctest.? > > > > --?? > > Muhammad > > > > > > -- > > *Muhammad* > -- *Muhammad* -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad.king at kitware.com Tue Apr 19 13:27:26 2016 From: brad.king at kitware.com (Brad King) Date: Tue, 19 Apr 2016 13:27:26 -0400 Subject: [CMake] Patch for BundleUtilities to ignore specified files In-Reply-To: <433E2230-A355-4F0B-BBF0-91074D09F5EB@gmx.at> References: <5714FD0B.6040502@kitware.com> <433E2230-A355-4F0B-BBF0-91074D09F5EB@gmx.at> Message-ID: <57166A7E.7070202@kitware.com> On 04/19/2016 02:03 AM, Roman W?ger wrote: > attached is an updated patch. Thanks. Applied: BundleUtilities: Add optional parameter to ignore specified files https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26c92d50 -Brad From chuck.atkins at kitware.com Tue Apr 19 13:56:34 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Tue, 19 Apr 2016 13:56:34 -0400 Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: <1460943193103-7593269.post@n2.nabble.com> References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> <1460943193103-7593269.post@n2.nabble.com> Message-ID: > cmake, the old top layer project is proj_a, which at the same layer with > proj_b and proj_c, if I add an extra top layer as the root you mentioned, the generated make file structure will be changed, top layer make file will be root instead of proj_a. > > Is there any way to add the dependency at proj_a level? > If you want proj_a, proj_b, and proj_c to all be built by the same make command, then it makes sense to have a top level organization that encompasses them all. Also, if proj_a, proj_b and proj_c don't make sense on their own and only when paired with each-other, then I would take the "project(...)" command out of each of them and only leave the top level. Basically, anything that has a project(...) command can be configured and built all on it's own without the rest of the tree. In this case, it may make sense to keep b and c as independent projects but a as not since it needs b and c. So for example, similar to Anatoly's example: *folder* CMakeLists.txt: project(root) add_subdirectory(proj_b) add_subdirectory(proj_c) add_subdirectory(proj_a) *folder/proj_a* CMakeLists.txt: add_executable(*A *main.cpp) target_link_libraries(*A B C*) *folder/proj_b* CMakeLists.txt: project(proj_b) add_library(B proj_b.cpp) *folder/proj_c* CMakeLists.txt: project(proj_c) add_library(*C *proj_c.cpp) With this structure, you can configure and build just project b or c: $ mkdir build_c $ cd build_c $ cmake /path/to/folder/proj_c ... $ make ... You end up with libC.a . Similarly, you could do that for proj_b and get libB.a. Or, if you configure the top level project instead: $ mkdir build_all $ cd build_all $ cmake /path/to/folder ... $ make Scanning dependencies of target B [ 16%] Building CXX object proj_b/CMakeFiles/B.dir/proj_b.o [ 33%] Linking CXX static library libB.a [ 33%] Built target B Scanning dependencies of target C [ 50%] Building CXX object proj_c/CMakeFiles/C.dir/proj_c.o [ 66%] Linking CXX static library libC.a [ 66%] Built target C Scanning dependencies of target A [ 83%] Building CXX object proj_a/CMakeFiles/A.dir/main.o [100%] Linking CXX executable A [100%] Built target A $ You end up with proj_b/libB.a, proj_c/libC.a, and proj_a/A which is linked with libB.a and libC.a. You can also do a parallel make with make -j(whatever) adn the generated dependencies will make sure that targets and individual files are built in the right order. Technically speaking, you don't *need* to have a CMakeLists.txt at each level and you could put it all in to one top level CMakeLists.txt but it's generally considered poor CMake code to do so. A good rule of thumb is to have a CMakeLsits.txt file at each level that a target (i.e. a library or executable) is built and a top level CMakeLists.txt to tie it all together. This is the same sort of approach you see with autoconf where it's typical to have a Makefile.am at each level. -------------- next part -------------- An HTML attachment was scrubbed... URL: From osama94 at gmail.com Tue Apr 19 14:14:40 2016 From: osama94 at gmail.com (Muhammad Osama) Date: Tue, 19 Apr 2016 11:14:40 -0700 Subject: [CMake] Replace `ctest` command with `ctest --output-on-failure` Message-ID: Hi, Is there a way I can replace ctest command with ctest --some-flag in CMakeLists.txt? So, when my users run cmake, make and ctest. They are actually performing cmake, make and ctest --some-flag? I don't want them to worry about the flag and just type ctest. Thank you, -- *Muhammad Osama* -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhongle at proplussolution.com Tue Apr 19 21:10:23 2016 From: zhongle at proplussolution.com (vakano) Date: Tue, 19 Apr 2016 18:10:23 -0700 (MST) Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> <1460943193103-7593269.post@n2.nabble.com> Message-ID: <1461114623949-7593293.post@n2.nabble.com> Hi, Chuck, Thanks for your great help! "Lib_B and Lib_C, build before A" that is exactly what I need. So for this parallel project structure, an upper level cmakelist used to organize and setup relationship with lib A, B, C right? One more question is, if use the upper level cmake list, lib_B , lib_C can be invoked directly without import in proj_a? Thanks, Le Chuck Atkins wrote >> cmake, the old top layer project is proj_a, which at the same layer with >> proj_b and proj_c, if I add an extra top layer as the root you mentioned, > > the generated make file structure will be changed, top layer make file > > will be root instead of proj_a. >> >> Is there any way to add the dependency at proj_a level? >> > > If you want proj_a, proj_b, and proj_c to all be built by the same make > command, then it makes sense to have a top level organization that > encompasses them all. Also, if proj_a, proj_b and proj_c don't make sense > on their own and only when paired with each-other, then I would take the > "project(...)" command out of each of them and only leave the top level. > Basically, anything that has a project(...) command can be configured and > built all on it's own without the rest of the tree. In this case, it may > make sense to keep b and c as independent projects but a as not since it > needs b and c. So for example, similar to Anatoly's example: > > *folder* > CMakeLists.txt: > project(root) > add_subdirectory(proj_b) > add_subdirectory(proj_c) > add_subdirectory(proj_a) > > *folder/proj_a* > CMakeLists.txt: > add_executable(*A *main.cpp) > target_link_libraries(*A B C*) > > *folder/proj_b* > CMakeLists.txt: > project(proj_b) > add_library(B proj_b.cpp) > > *folder/proj_c* > CMakeLists.txt: > project(proj_c) > add_library(*C *proj_c.cpp) > > > With this structure, you can configure and build just project b or c: > > $ mkdir build_c > $ cd build_c > $ cmake /path/to/folder/proj_c > ... > $ make > ... > > You end up with libC.a . Similarly, you could do that for proj_b and get > libB.a. Or, if you configure the top level project instead: > > $ mkdir build_all > $ cd build_all > $ cmake /path/to/folder > ... > $ make > Scanning dependencies of target B > [ 16%] Building CXX object proj_b/CMakeFiles/B.dir/proj_b.o > [ 33%] Linking CXX static library libB.a > [ 33%] Built target B > Scanning dependencies of target C > [ 50%] Building CXX object proj_c/CMakeFiles/C.dir/proj_c.o > [ 66%] Linking CXX static library libC.a > [ 66%] Built target C > Scanning dependencies of target A > [ 83%] Building CXX object proj_a/CMakeFiles/A.dir/main.o > [100%] Linking CXX executable A > [100%] Built target A > $ > > You end up with proj_b/libB.a, proj_c/libC.a, and proj_a/A which is linked > with libB.a and libC.a. You can also do a parallel make with make > -j(whatever) adn the generated dependencies will make sure that targets > and > individual files are built in the right order. Technically speaking, you > don't *need* to have a CMakeLists.txt at each level and you could put it > all in to one top level CMakeLists.txt but it's generally considered poor > CMake code to do so. A good rule of thumb is to have a CMakeLsits.txt > file > at each level that a target (i.e. a library or executable) is built and a > top level CMakeLists.txt to tie it all together. This is the same sort of > approach you see with autoconf where it's typical to have a Makefile.am at > each level. > > -- > > 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 -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593293.html Sent from the CMake mailing list archive at Nabble.com. From chuck.atkins at kitware.com Tue Apr 19 21:40:57 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Tue, 19 Apr 2016 21:40:57 -0400 Subject: [CMake] CMake: how to use 'for cyclic sentence' in command add_custom_command(...) In-Reply-To: References: <1461072051417-7593286.post@n2.nabble.com> Message-ID: Hi Chao, As Konstantin alluded to, trying to pass "srtingified" shell scripting through the layers of cmake and makefile escaping is bound to be fraught with problems. The necessary escaping will very quickly become unmaintainable. You're really best suited to place these in a separate shell script (or cmake script to make it os-portable) and just call the script from add_custom_command. Hi Mr. Atkins, Thanks a lot for your reply, and it worked well and help me a lot, there still are some confusions about "for cyclic sentence". I have tested some other case as below: add_custom_target(temp_target ALL) add_custom_command(TARGET temp_target POST_BUILD COMMAND if [ "$(dir_name)" = "test_dir" ]\; then echo $(dir_name)\; for x in $$\(cat $(file_name).txt\)\; do echo $$x \; echo $(file_name)\; done\; fi) Confusions: 1. I should use $$x in "for cyclic sentence", but i can not use $$(x) or $$\(x\). And i can use "$$\(cat $(file_name).txt\)" and it worked well. Even it worked when i use "$$x"(withdouble quote ). 2. When i make makefile, i use "make dir_name=test_dir file_name=test_file", and i can get the value of dir_name and file_name by use $(dir_name), $(file_name). Thanks again for your help, Chao Zhang 2016-04-19 22:20 GMT+08:00 Chuck Atkins : > Hi Chao, > > >> I was using 'for cyclic sentence' in command add_custom_command(...), the >> content of the CMakeLists.txt as below: >> add_custom_command(TARGET temp_target >> POST_BUILD >> COMMAND for x in a b c\; >> do echo $x \; >> done\;) >> > > The $x is getting parsed by the makefile so you need to escape it with the > $ makefile escape sequence. Try: > > add_custom_command(TARGET temp_target > POST_BUILD > COMMAND for x in a b c\; > do echo $$x \; > done\;) > > You can see the difference in a make VERBOSE=1 : > > [100%] Linking C static library libtemp_target.a > /home/ > khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -P > CMakeFiles/temp_target.dir/cmake_clean_target.cmake > /home/ > khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -E > cmake_link_script CMakeFiles/temp_target.dir/link.txt --verbose=1 > /usr/bin/ar qc libtemp_target.a CMakeFiles/temp_target.dir/foo.c.o > /usr/bin/ranlib libtemp_target.a > *for x in a b c; do echo ; done;* > > > > make[2]: Leaving directory '/home/khq.kitware.com/chuck.atkins/tmp/bld' > > Now becomes: > > [100%] Linking C static library libtemp_target.a > /home/ > khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -P > CMakeFiles/temp_target.dir/cmake_clean_target.cmake > /home/ > khq.kitware.com/chuck.atkins/Code/CMake/build/master-release/bin/cmake -E > cmake_link_script CMakeFiles/temp_target.dir/link.txt --verbose=1 > /usr/bin/ar qc libtemp_target.a CMakeFiles/temp_target.dir/foo.c.o > /usr/bin/ranlib libtemp_target.a > > > > *for x in a b c; do echo $x ; done;abc* > make[2]: Leaving directory '/home/khq.kitware.com/chuck.atkins/tmp/bld' > > - Chuck > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From David.Aldrich at EMEA.NEC.COM Wed Apr 20 05:41:55 2016 From: David.Aldrich at EMEA.NEC.COM (David Aldrich) Date: Wed, 20 Apr 2016 09:41:55 +0000 Subject: [CMake] How to use CMake with Eclipse CDT? Message-ID: <41302A7145AC054FA7A96CFD03835A0A0BAC3CC4@EX10MBX02.EU.NEC.COM> Hi I want to build an Eclipse CDT (C++) project on Linux that can be maintained using CMake. I have seen the notes on the Eclipse CDT4 Generator here: https://cmake.org/Wiki/Eclipse_CDT4_Generator Is the sole purpose of that generator to create a CDT project from a CMake makefile? Or, having run the generator, will CDT continue to maintain the project with CMake, adding new source files to CMakeLists.txt as required? This is what I want to achieve, so that my project can be built by another IDE, that understands CMake but not CDT, at any time. Best regards David -------------- next part -------------- An HTML attachment was scrubbed... URL: From David.Aldrich at EMEA.NEC.COM Wed Apr 20 06:16:36 2016 From: David.Aldrich at EMEA.NEC.COM (David Aldrich) Date: Wed, 20 Apr 2016 10:16:36 +0000 Subject: [CMake] How to use CMake with Eclipse CDT? Message-ID: <41302A7145AC054FA7A96CFD03835A0A0BAC3DA3@EX10MBX02.EU.NEC.COM> Hi I want to build an Eclipse CDT (C++) project on Linux that can be maintained using CMake. I have seen the notes on the Eclipse CDT4 Generator here: https://cmake.org/Wiki/Eclipse_CDT4_Generator Is the sole purpose of that generator to create a CDT project from a CMake makefile? Or, having run the generator, will CDT continue to maintain the project with CMake, adding new source files to CMakeLists.txt as required? This is what I want to achieve, so that my project can be built by another IDE, that understands CMake but not CDT, at any time. Best regards David -------------- next part -------------- An HTML attachment was scrubbed... URL: From Mateju.Miroslav at azd.cz Wed Apr 20 08:26:01 2016 From: Mateju.Miroslav at azd.cz (=?iso-8859-2?Q?Mat=ECj=F9_Miroslav=2C_Ing=2E?=) Date: Wed, 20 Apr 2016 12:26:01 +0000 Subject: [CMake] How to use CMake with Eclipse CDT? In-Reply-To: <41302A7145AC054FA7A96CFD03835A0A0BAC3CC4@EX10MBX02.EU.NEC.COM> References: <41302A7145AC054FA7A96CFD03835A0A0BAC3CC4@EX10MBX02.EU.NEC.COM> Message-ID: <4760442c7773492ab934a5d81f23ac7f@azdexchstore3.AZD.LOCAL> Hi David, Generation of project files in CMake is a one-way process. CMake is not able to edit its own input (CMakeLists.txt). To update a project managed by CMake, you should update CMakeLists.txt manually and regenerate your CDT project. Best regards, Miroslav From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of David Aldrich Sent: Wednesday, April 20, 2016 11:42 AM To: cmake at cmake.org Subject: [CMake] How to use CMake with Eclipse CDT? Hi I want to build an Eclipse CDT (C++) project on Linux that can be maintained using CMake. I have seen the notes on the Eclipse CDT4 Generator here: https://cmake.org/Wiki/Eclipse_CDT4_Generator Is the sole purpose of that generator to create a CDT project from a CMake makefile? Or, having run the generator, will CDT continue to maintain the project with CMake, adding new source files to CMakeLists.txt as required? This is what I want to achieve, so that my project can be built by another IDE, that understands CMake but not CDT, at any time. Best regards David -------------- next part -------------- An HTML attachment was scrubbed... URL: From claudio.caraffi at gmail.com Wed Apr 20 08:37:40 2016 From: claudio.caraffi at gmail.com (Claudio C) Date: Wed, 20 Apr 2016 14:37:40 +0200 Subject: [CMake] Module CheckIncludeFile should notify in case of flag errors Message-ID: I recently struggled with the command CheckIncludeFile (and siblings) while working with a custom toolchain. Even if I was setting the necessary CMAKE_SYSROOT, include_directories and even CMAKE_REQUIRED_INCLUDES, the commands would report a given header was not found. When I hacked into: CheckIncludeFile.cmake this line: message(STATUS "OUTPUT=${OUTPUT}") it turned out the problem was not in including file, but in the flags that were passed to the compiler, causing a failure. I think an error message should be printed instead in this case. This could be handled in 2 ways: a) Either checking first of all if, with the given flags, the compiler will succeed in compiling a source file containing JUST an empty main function. For efficiency, this check might even be done AFTER the first try_compile fails. b) Or, in case of failure, checking that the error returned is JUST the cannot find error message. What's your opinion about this? What would be the best option? Option a) seems to have the advantage of being extremely easy to implement, although might introduce some overhead. -------------- next part -------------- An HTML attachment was scrubbed... URL: From claudio.caraffi at gmail.com Wed Apr 20 09:30:07 2016 From: claudio.caraffi at gmail.com (Claudio C) Date: Wed, 20 Apr 2016 15:30:07 +0200 Subject: [CMake] how to really change CMake linker Message-ID: The proposed solution does not seem to work. There is now an issue related https://cmake.org/Bug/view.php?id=16059 -- Ing. Claudio Caraffi, PhD E-Mail: claudio.caraffi at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From chuck.atkins at kitware.com Wed Apr 20 09:34:16 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Wed, 20 Apr 2016 09:34:16 -0400 Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: <1461114623949-7593293.post@n2.nabble.com> References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> <1460943193103-7593269.post@n2.nabble.com> <1461114623949-7593293.post@n2.nabble.com> Message-ID: > So for this parallel project structure, an upper level cmakelist used to > organize and setup relationship with lib A, B, C right? > Correct. The top level CMakeLists.txt lets A B and C all build under a single configuration. One more question is, if use the upper level cmake list, lib_B , lib_C can > be invoked directly without import in proj_a? > If you configure the top level project, you can always invoke make on only the B or C targets via "make A" or "make B". However, by having the "project' command in the CMakeLists.txt for proj_b and proj_c, then those can also be treated as fully independent projects of their own, meaning they can either be configured by themselves or as a part of the top-level. - Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan556 at gmail.com Wed Apr 20 10:01:02 2016 From: johan556 at gmail.com (Johan Holmberg) Date: Wed, 20 Apr 2016 16:01:02 +0200 Subject: [CMake] Using Clang + Ninja on Windows? Message-ID: Hi! How should I setup CMake to build a C/C++ application on Windows using clang/clang++ as compilers and Ninja as build tool? I tried specifying "-GNinja" to cmake, and setting CC/CXX to clang/clang++. But this didn't work. I get errors like: clang.exe: error: no such file or directory: '/nologo' indicating that CMake thinks it should pass Visual C++ style options to clang. I'm thinking about fooling CMake that clang/clang++ are cross compilers (I know how to get cross compiling working in other cases). But since clang/clang++ are the native tools for Windows, I was hoping to be able to use Clang + Ninja on Windows almost like I use on Linux. If I run Clang from the command line, I can build my application, so my Clang-installation works. I'm using CMake 3.5.1 and Clang 3.8.0. /Johan Holmberg -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad.king at kitware.com Wed Apr 20 11:54:50 2016 From: brad.king at kitware.com (Brad King) Date: Wed, 20 Apr 2016 11:54:50 -0400 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: References: Message-ID: <5717A64A.1090906@kitware.com> On 04/20/2016 10:01 AM, Johan Holmberg wrote: > I tried specifying "-GNinja" to cmake, and setting CC/CXX to > clang/clang++. Good. > But this didn't work. I get errors like: > > clang.exe: error: no such file or directory: '/nologo' > > indicating that CMake thinks it should pass Visual C++ style > options to clang. There are multiple variants of Clang that behave like "gcc" or "cl". Which one is this? What installer did you use for Clang? CMake should start out by printing the compiler id for the C and CXX compilers. What did it show? Please try a minimum test project like >type CMakeLists.txt cmake_minimum_required(VERSION 3.5) project(Test) in a fresh build tree and post the files CMakeFiles/CMake*.log CMakeFiles/*/CMake*Compiler.cmake to see what CMake detected about the compiler. Thanks, -Brad From karl.ljungkvist at it.uu.se Wed Apr 20 14:19:39 2016 From: karl.ljungkvist at it.uu.se (Karl Ljungkvist) Date: Wed, 20 Apr 2016 13:19:39 -0500 Subject: [CMake] Adding include directories to generated CUDA files Message-ID: <5717C83B.5010306@it.uu.se> Hi all, I'm working with enabling CUDA support for the Finite Element Method library Deal.II, which includes a couple of cmake macros for the user to set up their Deal.II application. Inside one of these, I now need to correctly configure the include directories for the intermediately generated CUDA files. Specifically, CUDA_WRAP_SRCS sets up rules for all CUDA source files, and returns a list of all generated .cu.o files which is then passed to ADD_EXECUTABLE (all this happens inside CUDA_ADD_EXECUTABLE). In Deal.II, we have until now configured the include directories by setting a property on the target application: SET_PROPERTY(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES "${DEAL_II_INCLUDE_DIRS}" ) Now, this does not propagate to these generated cuda .cu.o files. I tried adding a similar call like this, but with ${_target} replaced by each of the generated .o files, but then I get this error: set_property could not find TARGET So my question is, how can I add include directories to these generated .cu.o files ? Adding a INCLUDE_DIRECTORIES before calling CUDA_WRAP_SRCS works, but we would prefer to do something that is specific to these files and not affect the global scope. Any help is greatly appreciated! Best regards, Karl -- Karl Ljungkvist PhD student Uppsala University Dept. of Information Technology Div. of Scientific Computing Box 337 SE-751 05 Uppsala, Sweden Email: karl.ljungkvist at it.uu.se Phone: +46 18 471 2967 Mobile: +46 70 2003565 From a.neundorf-work at gmx.net Wed Apr 20 16:14:31 2016 From: a.neundorf-work at gmx.net (Alexander Neundorf) Date: Wed, 20 Apr 2016 22:14:31 +0200 Subject: [CMake] How to check if Eclipse CDT4 generated project is set up correctly? In-Reply-To: <5714F5F0.6050505@exch.dwd.de> References: <5714F5F0.6050505@exch.dwd.de> Message-ID: <2155905.c0aDOjszdI@tuxedo.neundorf.net> On Monday, April 18, 2016 16:57:52 Nils Rathmann wrote: > Hi, > when I setup with the Eclipse CDT4 generator, as described here: > https://cmake.org/Wiki/Eclipse_CDT4_Generator4 > > my [Targets] folder contains virtual folders for CMakeRules, Header > Files, Object Files, Resources and Source Files, Yes, those are the standard groups created by cmake. > but only the source files folder is filled. If you list also the header files in the sources for a target, they will appear in the [Header Files] group. > The other folders are always empty, even if I > build the target or the whole project. Is there a documentation where I > can see how a generated Eclipse project should look like? When I compare > my project with the sample screenshot in the wiki linked above, it looks > totally different (mine has a lot of virtual folders like Subprojects, > Targets, ...) you should have a [Source directory] virtual folder pointing to ${CMAKE_SOURCE_DIR}. You should have a virtual folder [Subprojects], with one subdir for every project()-call in your project. The "Make targets" tab should have some global targets to build (like all, clean, rebuild_cache) and a "Build" and "Clean" make target for every target. Is this so ? Alex From zhongle at proplussolution.com Wed Apr 20 21:21:39 2016 From: zhongle at proplussolution.com (vakano) Date: Wed, 20 Apr 2016 18:21:39 -0700 (MST) Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> <1460943193103-7593269.post@n2.nabble.com> <1461114623949-7593293.post@n2.nabble.com> Message-ID: <1461201699296-7593305.post@n2.nabble.com> Hi, Chuck, Thanks for the explanation, it is very clear now. One last question is: *folder/proj_a* CMakeLists.txt: add_executable(A main.cpp) target_link_libraries(A B C) *folder/proj_b* CMakeLists.txt: project(proj_b) add_library(B proj_b.cpp) in your proj_a example, when target_link_librairies invoke Lib B directly which generated in another project b, how does proj_a recognize it, I think the reason is proj_a, b, c are all the sub directories of project root, if no root layer, B can not be invoked in proj_a, right? Thanks, vakano Chuck Atkins wrote >> So for this parallel project structure, an upper level cmakelist used to >> organize and setup relationship with lib A, B, C right? >> > > Correct. The top level CMakeLists.txt lets A B and C all build under a > single configuration. > > > One more question is, if use the upper level cmake list, lib_B , lib_C can >> be invoked directly without import in proj_a? >> > > If you configure the top level project, you can always invoke make on only > the B or C targets via "make A" or "make B". However, by having the > "project' command in the CMakeLists.txt for proj_b and proj_c, then those > can also be treated as fully independent projects of their own, meaning > they can either be configured by themselves or as a part of the top-level. > > - Chuck > > -- > > 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 -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593305.html Sent from the CMake mailing list archive at Nabble.com. From d3ck0r at gmail.com Wed Apr 20 22:01:35 2016 From: d3ck0r at gmail.com (J Decker) Date: Wed, 20 Apr 2016 19:01:35 -0700 Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: <1461201699296-7593305.post@n2.nabble.com> References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> <1460943193103-7593269.post@n2.nabble.com> <1461114623949-7593293.post@n2.nabble.com> <1461201699296-7593305.post@n2.nabble.com> Message-ID: On Wed, Apr 20, 2016 at 6:21 PM, vakano wrote: > Hi, Chuck, > > Thanks for the explanation, it is very clear now. > > One last question is: > > *folder/proj_a* > CMakeLists.txt: > add_executable(A main.cpp) > target_link_libraries(A B C) > > *folder/proj_b* > CMakeLists.txt: > project(proj_b) > add_library(B proj_b.cpp) > > in your proj_a example, when target_link_librairies invoke Lib B directly > which generated in another > > project b, how does proj_a recognize it, I think the reason is proj_a, b, c > are all the sub directories of > > project root, if no root layer, B can not be invoked in proj_a, right? > > Thanks, > vakano > Targets are global. ... Add_library( ${target_name} ${sources} ) later becomes $ as generator expressions also... add_executable( /*target_name*/ [WIN32 CONSOLE (default console)] ... ) add_library( /*target_name */ [STATIC or SHARED (default STATIC... ] ... ) actually there's a way to control what the defaults are if you don't specify anything.. but that tends to apply to the whole make system so if you just add_subdirectory( ../bullet3 bullet3 ) for instance it might end up doing things like appending 'd' to output names :) (it doesn't anymore) Sub-projects can also be built individually by going into theiry direcotry and doing a make (selecting the target and building in a gui) and it will build everything it's related to. > > > Chuck Atkins wrote >>> So for this parallel project structure, an upper level cmakelist used to >>> organize and setup relationship with lib A, B, C right? >>> >> >> Correct. The top level CMakeLists.txt lets A B and C all build under a >> single configuration. >> >> >> One more question is, if use the upper level cmake list, lib_B , lib_C can >>> be invoked directly without import in proj_a? >>> >> >> If you configure the top level project, you can always invoke make on only >> the B or C targets via "make A" or "make B". However, by having the >> "project' command in the CMakeLists.txt for proj_b and proj_c, then those >> can also be treated as fully independent projects of their own, meaning >> they can either be configured by themselves or as a part of the top-level. >> >> - Chuck >> >> -- >> >> 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 > > > > > > -- > View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593305.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 From zhongle at proplussolution.com Thu Apr 21 09:18:23 2016 From: zhongle at proplussolution.com (vakano) Date: Thu, 21 Apr 2016 06:18:23 -0700 (MST) Subject: [CMake] How to set link option Message-ID: <1461244703147-7593307.post@n2.nabble.com> Hi, I have some link option as below: -Wl, -rpath, ${PROJECT_TOP}/dist ../proj_a/lib_a.a -lb -Wl, --whole-archive ../proj_c/lib_c.a Thanks, Le -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-set-link-option-tp7593307.html Sent from the CMake mailing list archive at Nabble.com. From chuck.atkins at kitware.com Thu Apr 21 09:47:35 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Thu, 21 Apr 2016 09:47:35 -0400 Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: <1461201699296-7593305.post@n2.nabble.com> References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> <1460943193103-7593269.post@n2.nabble.com> <1461114623949-7593293.post@n2.nabble.com> <1461201699296-7593305.post@n2.nabble.com> Message-ID: > in your proj_a example, when target_link_librairies invoke Lib B directly > which generated in another project b, how does proj_a recognize it > I think the reason is proj_a, b, c are all the sub directories of > project root, if no root layer, B can not be invoked in proj_a, right? > That's correct. In the example I gave, while proj_a, proj_b, and proj_c are all sub-directories of the root level, only the root level, proj_b and proj_c CMakeLists.txt files contain a separate project(...) command, which meas that proj_b and proj_c can be configured and used independently but proj_a cannot and needs to be configured from the root level where the B and C targets are, in addition to their own separate projects, both contained in the root level project(...) where A can see them. - Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan556 at gmail.com Thu Apr 21 10:15:26 2016 From: johan556 at gmail.com (Johan Holmberg) Date: Thu, 21 Apr 2016 16:15:26 +0200 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: <5717A64A.1090906@kitware.com> References: <5717A64A.1090906@kitware.com> Message-ID: On Wed, Apr 20, 2016 at 5:54 PM, Brad King wrote: > On 04/20/2016 10:01 AM, Johan Holmberg wrote: > > I tried specifying "-GNinja" to cmake, and setting CC/CXX to > > clang/clang++. > > Good. > > > But this didn't work. I get errors like: > > > > clang.exe: error: no such file or directory: '/nologo' > > > > indicating that CMake thinks it should pass Visual C++ style > > options to clang. > > There are multiple variants of Clang that behave like "gcc" or "cl". > Which one is this? What installer did you use for Clang? > I used the installer at http://llvm.org/releases/3.8.0/LLVM-3.8.0-win64.exe . I chose the binaries behaving like "gcc": After installation I added the "bin" directory to my PATH (actual command "set path=e:\work\install\LLVM\bin;%PATH%"). In the new bin-directory there are binaries called "clang.exe" and "clang++.exe" + a bunch of other binaries eg. "clang-cl.exe". I did NOT put the directory "e:\work\install\LLVM\msbuild-bin" in my PATH (containing a binary "cl.exe"). I realize that Cristian Adams recommended using the "cl.exe" wrapper in his response, but I wanted at least to try using the "gcc-like" binaries first, hoping that they should work with CMake. I will probably try his advice later, but as I understand it, both ways should be possible to get working with CMake. > CMake should start out by printing the compiler id for the C and > CXX compilers. What did it show? > > CMake starts by saying: E:\work\proj\hello1\build> cmake -GNinja ..\src -- The C compiler identification is Clang 3.8.0 -- The CXX compiler identification is Clang 3.8.0 -- Check for working C compiler using: Ninja -- Check for working C compiler using: Ninja -- broken [...rest removed...] Please try a minimum test project like > > >type CMakeLists.txt > cmake_minimum_required(VERSION 3.5) > project(Test) > > in a fresh build tree and post the files > > CMakeFiles/CMake*.log > CMakeFiles/*/CMake*Compiler.cmake > > to see what CMake detected about the compiler. > Thanks, > -Brad > > OK, I attach the files to this mail. There were three file created: build/CMakeFiles/3.5.1/CMakeRCCompiler.cmake build/CMakeFiles/CMakeError.log build/CMakeFiles/CMakeOutput.log On my Windows machine I have Visual Studio 2008, 2012, 2013 and 2015. I used CMake 3.5.1 and Ninja 1.6.0. /Johan Holmberg -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CMakeOutput.log Type: text/x-log Size: 847 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CMakeError.log Type: text/x-log Size: 1342 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CMakeRCCompiler.cmake Type: text/x-cmake Size: 212 bytes Desc: not available URL: From brad.king at kitware.com Thu Apr 21 11:17:52 2016 From: brad.king at kitware.com (Brad King) Date: Thu, 21 Apr 2016 11:17:52 -0400 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: References: <5717A64A.1090906@kitware.com> Message-ID: <5718EF20.4020704@kitware.com> On 04/21/2016 10:15 AM, Johan Holmberg wrote: > I chose the binaries behaving like "gcc" > > I realize that Cristian Adams recommended using the "cl.exe" wrapper in > his response, but I wanted at least to try using the "gcc-like" binaries > first, hoping that they should work with CMake. I think that is the problem. See below. > E:\work\proj\hello1\build> cmake -GNinja ..\src > -- The C compiler identification is Clang 3.8.0 > -- The CXX compiler identification is Clang 3.8.0 >From the compiler id files you sent me I see: $ strings build/CMakeFiles/3.5.1/CompilerIdC/a.exe | grep INFO INFO:compiler[Clang] INFO:simulate[MSVC] INFO:compiler_version[00000003.00000008.00000000] INFO:simulate_version[00000018.00000000] INFO:platform[Windows] INFO:arch[x64] INFO:dialect_default[11] $ strings build/CMakeFiles/3.5.1/CompilerIdCXX/a.exe | grep INFO INFO:compiler[Clang] INFO:simulate[MSVC] INFO:platform[Windows] INFO:arch[x64] INFO:dialect_default[11] INFO:compiler_version[00000003.00000008.00000000] INFO:simulate_version[00000018.00000000] The "INFO:simulate[MSVC]" lines mean that CMake has detected that the given Clang compiler defines _MSC_VER and therefore acts like MSVC and not GNU (i.e. uses the msvc ABI instead of the gnu ABI). CMake then assumes that the compiler command line is compatible with "cl". We have code that switches off this here: https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Windows-Clang.cmake;hb=v3.5.2 https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/Clang.cmake;hb=v3.5.2 When all that was written clang-cl was still under development and our assumption was that there is no such thing as a Clang that acts like MSVC but is not cl-compatible on the command line. -Brad From cristian.adam at gmail.com Thu Apr 21 17:30:08 2016 From: cristian.adam at gmail.com (Cristian Adam) Date: Thu, 21 Apr 2016 23:30:08 +0200 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: References: Message-ID: On Wed, Apr 20, 2016 at 4:01 PM, Johan Holmberg wrote: > Hi! > > How should I setup CMake to build a C/C++ application on Windows using > clang/clang++ as compilers and Ninja as build tool? > > I tried specifying "-GNinja" to cmake, and setting CC/CXX to > clang/clang++. But this didn't work. I get errors like: > > clang.exe: error: no such file or directory: '/nologo' > > indicating that CMake thinks it should pass Visual C++ style options to > clang. > > I'm thinking about fooling CMake that clang/clang++ are cross compilers (I > know how to get cross compiling working in other cases). But since > clang/clang++ are the native tools for Windows, I was hoping to be able to > use Clang + Ninja on Windows almost like I use on Linux. > > If I run Clang from the command line, I can build my application, so my > Clang-installation works. > > I'm using CMake 3.5.1 and Clang 3.8.0. > > /Johan Holmberg > > Hi, On Windows Clang works only with Visual C++, since they don't provide libc++. MinGW is not supported. Clang provides a Visual C++'s cl.exe replacement. You need to have the official windows Clang and Visual C++ Express or Community installed. Then it's just a matter of: 1. Opening a Visual C++ 2013 64 bit command prompt window 2. Putting clang's cl.exe in the path and setting clang's INCLUDE path first set PATH=c:\Program Files\LLVM\msbuild-bin\;%PATH% set INCLUDE=c:\Program Files\LLVM\lib\clang\3.8.0\include\;%INCLUDE% 3. cmake -G "Ninja" 4. Ninja CMake / Ninja will think that they compile with Visual C++, but instead will use clang. Note that you have to match Visual C++ and Clang's build, 32 or 64 bit. You can't mix them, or you'll have weird errors . Cheers, Cristian. P.S. This is actually a re-post, this time adding the mailing list. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ggarra13 at gmail.com Thu Apr 21 22:03:57 2016 From: ggarra13 at gmail.com (Gonzalo) Date: Thu, 21 Apr 2016 23:03:57 -0300 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: References: Message-ID: <5719868D.60204@gmail.com> El 21/04/16 a las 18:30, Cristian Adam escribi?:} > Note that you have to match Visual C++ and Clang's build, 32 or 64 bit. You can't mix them, > or you'll have weird errors . I wonder. Are the C and C++ ABIs of both compilers compatible? That is, can I develop a program with clang but use visualc++ dlls or viceversa. -- Gonzalo Garramu?o ggarra13 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhongle at proplussolution.com Fri Apr 22 01:07:55 2016 From: zhongle at proplussolution.com (vakano) Date: Thu, 21 Apr 2016 22:07:55 -0700 (MST) Subject: [CMake] How to add dependency relations between libs and executable In-Reply-To: References: <1460881879295-7593264.post@n2.nabble.com> <57136F29.4030708@mail.ru> <1460943193103-7593269.post@n2.nabble.com> <1461114623949-7593293.post@n2.nabble.com> <1461201699296-7593305.post@n2.nabble.com> Message-ID: <1461301675606-7593313.post@n2.nabble.com> Hi, Chuck, J, Thanks for you all great help! It is clear for me now ^.^ vakano -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593313.html Sent from the CMake mailing list archive at Nabble.com. From zcsd2012 at gmail.com Fri Apr 22 01:25:22 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Thu, 21 Apr 2016 22:25:22 -0700 (MST) Subject: [CMake] CMake:question of the time when the command will happen in add_custom_command(...) Message-ID: <1461302722133-7593314.post@n2.nabble.com> Hi all, I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in command "add_custom_command(...)". When i use POST_BUILD, i found the command will execute before target had been built, like this: 1 [root at VM_33_35_centos build]# make 2 Scanning dependencies of target main 3 [100%] Building C object CMakeFiles/main.dir/main.c.o 4 Linking C executable main 5 This is pre build 6 This is post build 7 [100%] Built target main In my CMakeLists.txt, the content is: 1 cmake_minimum_required(VERSION 2.8) 2 add_executable(main main.c) 3 add_custom_command(TARGET main 4 PRE_BUILD 5 COMMAND echo "This is pre build " 6 ) 7 add_custom_command(TARGET main 8 POST_BUILD 9 COMMAND echo "This is post build" 10 ) Why the command echo "This is post build" in 8 line(CMakeLists.txt) did not execute after [100%] Built target main in 7 line(Linux command)? -- View this message in context: http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html Sent from the CMake mailing list archive at Nabble.com. From Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de Fri Apr 22 02:59:15 2016 From: Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de (Mueller-Roemer, Johannes Sebastian) Date: Fri, 22 Apr 2016 06:59:15 +0000 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: References: Message-ID: <8D981219EEA621479C112DA9BDC39A8E6367D33D@EXMBS1.ad.igd.fraunhofer.de> You are mistaken, Clang absolutely also works with MinGW. Or it did at least up to 3.7 (didn?t get around to trying 3.8 yet) From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Cristian Adam Sent: Thursday, April 21, 2016 23:30 To: Johan Holmberg Cc: cmake at cmake.org Subject: Re: [CMake] Using Clang + Ninja on Windows? On Wed, Apr 20, 2016 at 4:01 PM, Johan Holmberg > wrote: Hi! How should I setup CMake to build a C/C++ application on Windows using clang/clang++ as compilers and Ninja as build tool? I tried specifying "-GNinja" to cmake, and setting CC/CXX to clang/clang++. But this didn't work. I get errors like: clang.exe: error: no such file or directory: '/nologo' indicating that CMake thinks it should pass Visual C++ style options to clang. I'm thinking about fooling CMake that clang/clang++ are cross compilers (I know how to get cross compiling working in other cases). But since clang/clang++ are the native tools for Windows, I was hoping to be able to use Clang + Ninja on Windows almost like I use on Linux. If I run Clang from the command line, I can build my application, so my Clang-installation works. I'm using CMake 3.5.1 and Clang 3.8.0. /Johan Holmberg Hi, On Windows Clang works only with Visual C++, since they don't provide libc++. MinGW is not supported. Clang provides a Visual C++'s cl.exe replacement. You need to have the official windows Clang and Visual C++ Express or Community installed. Then it's just a matter of: 1. Opening a Visual C++ 2013 64 bit command prompt window 2. Putting clang's cl.exe in the path and setting clang's INCLUDE path first set PATH=c:\Program Files\LLVM\msbuild-bin\;%PATH% set INCLUDE=c:\Program Files\LLVM\lib\clang\3.8.0\include\;%INCLUDE% 3. cmake -G "Ninja" 4. Ninja CMake / Ninja will think that they compile with Visual C++, but instead will use clang. Note that you have to match Visual C++ and Clang's build, 32 or 64 bit. You can't mix them, or you'll have weird errors. Cheers, Cristian. P.S. This is actually a re-post, this time adding the mailing list. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cristian.adam at gmail.com Fri Apr 22 03:15:21 2016 From: cristian.adam at gmail.com (Cristian Adam) Date: Fri, 22 Apr 2016 09:15:21 +0200 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: <8D981219EEA621479C112DA9BDC39A8E6367D33D@EXMBS1.ad.igd.fraunhofer.de> References: <8D981219EEA621479C112DA9BDC39A8E6367D33D@EXMBS1.ad.igd.fraunhofer.de> Message-ID: On Fri, Apr 22, 2016 at 8:59 AM, Mueller-Roemer, Johannes Sebastian < Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote: > You are mistaken, Clang absolutely also works with MinGW. Or it did at > least up to 3.7 (didn?t get around to trying 3.8 yet) > > > Clang works fine with libstdc++ on Linux and Cygwin, there should be no reason why it shouldn't work with MinGW. What I should have wrote was that Clang on Windows officially supports only a Visual C++ setup / Visual Studio integration. I don't think I have seen a package containing clang and libstdc++ from MinGW. Cheers, Cristian. -------------- next part -------------- An HTML attachment was scrubbed... URL: From petr.kmoch at gmail.com Fri Apr 22 04:38:48 2016 From: petr.kmoch at gmail.com (Petr Kmoch) Date: Fri, 22 Apr 2016 09:38:48 +0100 Subject: [CMake] CMake:question of the time when the command will happen in add_custom_command(...) In-Reply-To: <1461302722133-7593314.post@n2.nabble.com> References: <1461302722133-7593314.post@n2.nabble.com> Message-ID: Hi, the reason is that the post-build command is actually a part of building "main the target." Once you introduce custom commands into a target, building it includes them all, and not just compiling the object files and linking the binary. You will notice that the "Linking C exectuable main" line came before the post-build message, so it did happen in the correct order. Petr On 22 April 2016 at 06:25, Chaos Zhang wrote: > Hi all, > > I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in command > "add_custom_command(...)". When i use POST_BUILD, i found the command will > execute before target had been built, like this: > > 1 [root at VM_33_35_centos build]# make > 2 Scanning dependencies of target main > 3 [100%] Building C object CMakeFiles/main.dir/main.c.o > 4 Linking C executable main > 5 This is pre build > 6 This is post build > 7 [100%] Built target main > > In my CMakeLists.txt, the content is: > 1 cmake_minimum_required(VERSION 2.8) > 2 add_executable(main main.c) > 3 add_custom_command(TARGET main > 4 PRE_BUILD > 5 COMMAND echo "This is pre build " > 6 ) > 7 add_custom_command(TARGET main > 8 POST_BUILD > 9 COMMAND echo "This is post build" > 10 ) > > Why the command echo "This is post build" in 8 line(CMakeLists.txt) did not > execute after [100%] Built target main in 7 line(Linux command)? > > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de Fri Apr 22 04:51:12 2016 From: Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de (Mueller-Roemer, Johannes Sebastian) Date: Fri, 22 Apr 2016 08:51:12 +0000 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: References: <8D981219EEA621479C112DA9BDC39A8E6367D33D@EXMBS1.ad.igd.fraunhofer.de> Message-ID: <8D981219EEA621479C112DA9BDC39A8E6367D3B7@EXMBS1.ad.igd.fraunhofer.de> It is true that there is no official bundled installer with both, but the official installer works just fine with mingw as long as you pass in the correct target to clang(++) For example clang++ --target=x86_64-w64-mingw32 test.cpp However, it assumes that mingw64 is installed under C:/mingw64 (the default location, it?ll work with a junction point though). From: Cristian Adam [mailto:cristian.adam at gmail.com] Sent: Friday, April 22, 2016 09:15 To: Mueller-Roemer, Johannes Sebastian Cc: cmake at cmake.org Subject: Re: [CMake] Using Clang + Ninja on Windows? On Fri, Apr 22, 2016 at 8:59 AM, Mueller-Roemer, Johannes Sebastian > wrote: You are mistaken, Clang absolutely also works with MinGW. Or it did at least up to 3.7 (didn?t get around to trying 3.8 yet) Clang works fine with libstdc++ on Linux and Cygwin, there should be no reason why it shouldn't work with MinGW. What I should have wrote was that Clang on Windows officially supports only a Visual C++ setup / Visual Studio integration. I don't think I have seen a package containing clang and libstdc++ from MinGW. Cheers, Cristian. -------------- next part -------------- An HTML attachment was scrubbed... URL: From petr.kmoch at gmail.com Fri Apr 22 05:26:10 2016 From: petr.kmoch at gmail.com (Petr Kmoch) Date: Fri, 22 Apr 2016 10:26:10 +0100 Subject: [CMake] CMake:question of the time when the command will happen in add_custom_command(...) In-Reply-To: References: <1461302722133-7593314.post@n2.nabble.com> Message-ID: No, it is indeed compiled and linked just fine. What I meant is: Without any custom commands, the build process conceptually looks like this: buildMain() { compile_object_files(); link_main_binary(); message("Built target main"); } With a post-build custom command: buildMain() { compile_object_files(); link_main_binary(); post_build_command(); message("Built target main"); } The custom command becomes a part of the entire process of "Building target," that's why the "Built target" message appears after the command runs. BTW, please keep the mailing list in copy when replying. Petr On 22 April 2016 at 10:02, Chaos Zhang wrote: > So what you mean is the target have not been complied and linked after i introduce > custom commands into this target right? Do i understand right? > > Thanks a lot for your generous help. :-) > > 2016-04-22 16:38 GMT+08:00 Petr Kmoch : > >> Hi, >> >> the reason is that the post-build command is actually a part of building >> "main the target." Once you introduce custom commands into a target, >> building it includes them all, and not just compiling the object files and >> linking the binary. You will notice that the "Linking C exectuable main" >> line came before the post-build message, so it did happen in the correct >> order. >> >> Petr >> >> On 22 April 2016 at 06:25, Chaos Zhang wrote: >> >>> Hi all, >>> >>> I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in >>> command >>> "add_custom_command(...)". When i use POST_BUILD, i found the command >>> will >>> execute before target had been built, like this: >>> >>> 1 [root at VM_33_35_centos build]# make >>> 2 Scanning dependencies of target main >>> 3 [100%] Building C object CMakeFiles/main.dir/main.c.o >>> 4 Linking C executable main >>> 5 This is pre build >>> 6 This is post build >>> 7 [100%] Built target main >>> >>> In my CMakeLists.txt, the content is: >>> 1 cmake_minimum_required(VERSION 2.8) >>> 2 add_executable(main main.c) >>> 3 add_custom_command(TARGET main >>> 4 PRE_BUILD >>> 5 COMMAND echo "This is pre build " >>> 6 ) >>> 7 add_custom_command(TARGET main >>> 8 POST_BUILD >>> 9 COMMAND echo "This is post build" >>> 10 ) >>> >>> Why the command echo "This is post build" in 8 line(CMakeLists.txt) did >>> not >>> execute after [100%] Built target main in 7 line(Linux command)? >>> >>> >>> >>> >>> -- >>> View this message in context: >>> http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html >>> Sent from the CMake mailing list archive at Nabble.com. >>> -- >>> >>> 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 >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zcsd2012 at gmail.com Fri Apr 22 05:53:12 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Fri, 22 Apr 2016 02:53:12 -0700 (MST) Subject: [CMake] CMake:question of the time when the command will happen in add_custom_command(...) In-Reply-To: References: <1461302722133-7593314.post@n2.nabble.com> Message-ID: <1461318792328-7593320.post@n2.nabble.com> Sorry for i just know reply by email and thinks for your help again. :-) Petr Kmoch wrote > No, it is indeed compiled and linked just fine. What I meant is: > > Without any custom commands, the build process conceptually looks like > this: > > buildMain() { > compile_object_files(); > link_main_binary(); > > message("Built target main"); > } > > With a post-build custom command: > > buildMain() { > compile_object_files(); > link_main_binary(); > post_build_command(); > > message("Built target main"); > } > > The custom command becomes a part of the entire process of "Building > target," that's why the "Built target" message appears after the command > runs. > > BTW, please keep the mailing list in copy when replying. > > Petr > > On 22 April 2016 at 10:02, Chaos Zhang < > zcsd2012@ > > wrote: > >> So what you mean is the target have not been complied and linked after i >> introduce >> custom commands into this target right? Do i understand right? >> >> Thanks a lot for your generous help. :-) >> >> 2016-04-22 16:38 GMT+08:00 Petr Kmoch < > petr.kmoch@ > >: >> >>> Hi, >>> >>> the reason is that the post-build command is actually a part of building >>> "main the target." Once you introduce custom commands into a target, >>> building it includes them all, and not just compiling the object files >>> and >>> linking the binary. You will notice that the "Linking C exectuable main" >>> line came before the post-build message, so it did happen in the correct >>> order. >>> >>> Petr >>> >>> On 22 April 2016 at 06:25, Chaos Zhang < > zcsd2012@ > > wrote: >>> >>>> Hi all, >>>> >>>> I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in >>>> command >>>> "add_custom_command(...)". When i use POST_BUILD, i found the command >>>> will >>>> execute before target had been built, like this: >>>> >>>> 1 [root at VM_33_35_centos build]# make >>>> 2 Scanning dependencies of target main >>>> 3 [100%] Building C object CMakeFiles/main.dir/main.c.o >>>> 4 Linking C executable main >>>> 5 This is pre build >>>> 6 This is post build >>>> 7 [100%] Built target main >>>> >>>> In my CMakeLists.txt, the content is: >>>> 1 cmake_minimum_required(VERSION 2.8) >>>> 2 add_executable(main main.c) >>>> 3 add_custom_command(TARGET main >>>> 4 PRE_BUILD >>>> 5 COMMAND echo "This is pre build " >>>> 6 ) >>>> 7 add_custom_command(TARGET main >>>> 8 POST_BUILD >>>> 9 COMMAND echo "This is post build" >>>> 10 ) >>>> >>>> Why the command echo "This is post build" in 8 line(CMakeLists.txt) did >>>> not >>>> execute after [100%] Built target main in 7 line(Linux command)? >>>> >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>>> http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html >>>> Sent from the CMake mailing list archive at Nabble.com. >>>> -- >>>> >>>> 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 -- View this message in context: http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314p7593320.html Sent from the CMake mailing list archive at Nabble.com. From Nils.Rathmann at dwd.de Fri Apr 22 07:28:33 2016 From: Nils.Rathmann at dwd.de (Nils Rathmann) Date: Fri, 22 Apr 2016 13:28:33 +0200 Subject: [CMake] How to check if Eclipse CDT4 generated project is set up correctly? In-Reply-To: <2155905.c0aDOjszdI@tuxedo.neundorf.net> References: <5714F5F0.6050505@exch.dwd.de> <2155905.c0aDOjszdI@tuxedo.neundorf.net> Message-ID: <571A0AE1.2050107@exch.dwd.de> Hi Alex, thanks for the details. I managed to add the header files as intended and do have the targets you described, but the virtual directories "CMake Rules", "Object Files" and "Ressources" of each Target subdirectory are still empty. What is the intention of these virtual directories? Thank you, Nils Am 20.04.2016 um 22:14 schrieb Alexander Neundorf: > On Monday, April 18, 2016 16:57:52 Nils Rathmann wrote: >> Hi, >> when I setup with the Eclipse CDT4 generator, as described here: >> https://cmake.org/Wiki/Eclipse_CDT4_Generator4 >> >> my [Targets] folder contains virtual folders for CMakeRules, Header >> Files, Object Files, Resources and Source Files, > Yes, those are the standard groups created by cmake. > >> but only the source files folder is filled. > If you list also the header files in the sources for a target, they will > appear in the [Header Files] group. > >> The other folders are always empty, even if I >> build the target or the whole project. Is there a documentation where I >> can see how a generated Eclipse project should look like? When I compare >> my project with the sample screenshot in the wiki linked above, it looks >> totally different (mine has a lot of virtual folders like Subprojects, >> Targets, ...) > you should have a [Source directory] virtual folder pointing to > ${CMAKE_SOURCE_DIR}. > You should have a virtual folder [Subprojects], with one subdir for every > project()-call in your project. > > The "Make targets" tab should have some global targets to build (like all, > clean, rebuild_cache) and a "Build" and "Clean" make target for every target. > > Is this so ? > > Alex > From chuck.atkins at kitware.com Fri Apr 22 10:58:22 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Fri, 22 Apr 2016 10:58:22 -0400 Subject: [CMake] CMake:question of the time when the command will happen in add_custom_command(...) In-Reply-To: <1461318792328-7593320.post@n2.nabble.com> References: <1461302722133-7593314.post@n2.nabble.com> <1461318792328-7593320.post@n2.nabble.com> Message-ID: Hi Chao, You can see this more clearly if you do a "make VERBOSE=1" : [chuck.atkins at hal9000 build]$ make VERBOSE=1 ... [ 50%] Building C object CMakeFiles/main.dir/main.c.o /usr/bin/cc -o CMakeFiles/main.dir/main.c.o -c /home/chuck.atkins/Code/tmp/source/main.c [100%] Linking C executable main *echo This\ is\ pre\ build\ This is pre build * /usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1 */usr/bin/cc CMakeFiles/main.dir/main.c.o -o main -rdynamic * *echo This\ is\ post\ buildThis is post build* make[2]: Leaving directory '/home/chuck.atkins/Code/tmp/build' [100%] Built target main make[1]: Leaving directory '/home/chuck.atkins/Code/tmp/build' /usr/bin/cmake -E cmake_progress_start /home/chuck.atkins/Code/tmp/build/CMakeFiles 0 [chuck.atkins at hal9000 build]$ Here you can see the order of command execution is PRE_BUILD -> Link -> POST_BUILD - Chuck On Fri, Apr 22, 2016 at 5:53 AM, Chaos Zhang wrote: > Sorry for i just know reply by email and thinks for your help again. :-) > > > Petr Kmoch wrote > > No, it is indeed compiled and linked just fine. What I meant is: > > > > Without any custom commands, the build process conceptually looks like > > this: > > > > buildMain() { > > compile_object_files(); > > link_main_binary(); > > > > message("Built target main"); > > } > > > > With a post-build custom command: > > > > buildMain() { > > compile_object_files(); > > link_main_binary(); > > post_build_command(); > > > > message("Built target main"); > > } > > > > The custom command becomes a part of the entire process of "Building > > target," that's why the "Built target" message appears after the command > > runs. > > > > BTW, please keep the mailing list in copy when replying. > > > > Petr > > > > On 22 April 2016 at 10:02, Chaos Zhang < > > > zcsd2012@ > > > > wrote: > > > >> So what you mean is the target have not been complied and linked after i > >> introduce > >> custom commands into this target right? Do i understand right? > >> > >> Thanks a lot for your generous help. :-) > >> > >> 2016-04-22 16:38 GMT+08:00 Petr Kmoch < > > > petr.kmoch@ > > > >: > >> > >>> Hi, > >>> > >>> the reason is that the post-build command is actually a part of > building > >>> "main the target." Once you introduce custom commands into a target, > >>> building it includes them all, and not just compiling the object files > >>> and > >>> linking the binary. You will notice that the "Linking C exectuable > main" > >>> line came before the post-build message, so it did happen in the > correct > >>> order. > >>> > >>> Petr > >>> > >>> On 22 April 2016 at 06:25, Chaos Zhang < > > > zcsd2012@ > > > > wrote: > >>> > >>>> Hi all, > >>>> > >>>> I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in > >>>> command > >>>> "add_custom_command(...)". When i use POST_BUILD, i found the command > >>>> will > >>>> execute before target had been built, like this: > >>>> > >>>> 1 [root at VM_33_35_centos build]# make > >>>> 2 Scanning dependencies of target main > >>>> 3 [100%] Building C object CMakeFiles/main.dir/main.c.o > >>>> 4 Linking C executable main > >>>> 5 This is pre build > >>>> 6 This is post build > >>>> 7 [100%] Built target main > >>>> > >>>> In my CMakeLists.txt, the content is: > >>>> 1 cmake_minimum_required(VERSION 2.8) > >>>> 2 add_executable(main main.c) > >>>> 3 add_custom_command(TARGET main > >>>> 4 PRE_BUILD > >>>> 5 COMMAND echo "This is pre build " > >>>> 6 ) > >>>> 7 add_custom_command(TARGET main > >>>> 8 POST_BUILD > >>>> 9 COMMAND echo "This is post build" > >>>> 10 ) > >>>> > >>>> Why the command echo "This is post build" in 8 line(CMakeLists.txt) > did > >>>> not > >>>> execute after [100%] Built target main in 7 line(Linux command)? > >>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> View this message in context: > >>>> > http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html > >>>> Sent from the CMake mailing list archive at Nabble.com. > >>>> -- > >>>> > >>>> 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 > > > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314p7593320.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fifteenknots505 at gmail.com Fri Apr 22 14:33:47 2016 From: fifteenknots505 at gmail.com (Martin Weber) Date: Fri, 22 Apr 2016 20:33:47 +0200 Subject: [CMake] How to check if Eclipse CDT4 generated project is set up correctly? In-Reply-To: <571A0AE1.2050107@exch.dwd.de> References: <5714F5F0.6050505@exch.dwd.de> <2155905.c0aDOjszdI@tuxedo.neundorf.net> <571A0AE1.2050107@exch.dwd.de> Message-ID: <3667406.FPWffH5mkm@linux> Am Freitag, 22. April 2016, 13:28:33 schrieb Nils Rathmann: > Hi Alex, > thanks for the details. I managed to add the header files as intended > and do have the targets you described, but the virtual directories > "CMake Rules", "Object Files" and "Ressources" of each Target > subdirectory are still empty. What is the intention of these virtual > directories? Hi Nils, the Eclipse Marketplace has some plugins that help you to work with cmake in Eclipse. Just search for 'cmake'... Martin From ndeubert at gmail.com Fri Apr 22 14:59:41 2016 From: ndeubert at gmail.com (Nick Deubert) Date: Fri, 22 Apr 2016 14:59:41 -0400 Subject: [CMake] Finding 32bit libs on 64bit Ubuntu install Message-ID: Hey everyone, I am trying to build and link some 32bit binaries on Ubuntu 15.10 64bit, but no matter what combination of arguments I give FIND_LIBRARY I cannot get it to use the 32bit libs. I have been scouring the mailing lists and came up with all these things to try but nothing has worked so far. I am using cmake 3.0.2. Please let me know what I am missing. Thanks in advance for your help. Nick The relevant part of my cmake file: Set(CFLAGS "-m32") Set(CXXFLAGS "-m32") Set(CMAKE_C_FLAGS "-m32") Set(CMAKE_CXX_FLAGS "-m32") Set(CMAKE_SHARED_LINKER_FLAGS "-m32") Set(FIND_LIBRARY_USE_LIB64_PATHS OFF) MESSAGE( STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH} ) MESSAGE( STATUS "CFLAGS: " ${CFLAGS} ) MESSAGE( STATUS "CXXFLAGS: " ${CXXFLAGS} ) MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} ) MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} ) MESSAGE( STATUS "CMAKE_SHARED_LINKER_FLAGS: " ${CMAKE_SHARED_LINKER_FLAGS} ) MESSAGE( STATUS "FIND_LIBRARY_USE_LIB64_PATHS: " ${FIND_LIBRARY_USE_LIB64_PATHS} ) FIND_LIBRARY(DL_LIBRARY NAMES dl PATHS ${LIB_PATH} NO_DEFAULT_PATH) FIND_LIBRARY(NL_LIBRARY NAMES nl PATHS ${LIB_PATH} NO_DEFAULT_PATH) FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread PATHS ${LIB_PATH} NO_DEFAULT_PATH) MESSAGE(STATUS "DL_LIBRARY is ${DL_LIBRARY}") MESSAGE(STATUS "NL_LIBRARY is ${NL_LIBRARY}") MESSAGE(STATUS "PTHREAD_LIBRARY is ${PTHREAD_LIBRARY}") The output I get: -- CMAKE_LIBRARY_PATH: /lib/i386-linux-gnu -- CFLAGS: -m32 -- CXXFLAGS: -m32 -- CMAKE_C_FLAGS: -m32 -- CMAKE_CXX_FLAGS: -m32 -- CMAKE_SHARED_LINKER_FLAGS: -m32 -- FIND_LIBRARY_USE_LIB64_PATHS: OFF -- DL_LIBRARY is DL_LIBRARY-NOTFOUND -- NL_LIBRARY is NL_LIBRARY-NOTFOUND -- PTHREAD_LIBRARY is PTHREAD_LIBRARY-NOTFOUND Without NO_DEFAULT_PATH: -- DL_LIBRARY is /usr/lib/x86_64-linux-gnu/libdl.so -- NL_LIBRARY is /lib/x86_64-linux-gnu/libnl.so -- PTHREAD_LIBRARY is /usr/lib/x86_64-linux-gnu/libpthread.so Proof that I have the 32bit libs installed: $ ls -l /lib/i386-linux-gnu/*pthread* -rwxr-xr-x 1 root root 137044 Feb 16 14:06 /lib/i386-linux-gnu/libpthread-2.21.so* lrwxrwxrwx 1 root root 18 Feb 16 14:06 /lib/i386-linux-gnu/libpthread.so.0 -> libpthread-2.21.so* $ ls -l /lib/i386-linux-gnu/*libnl* -rw-r--r-- 1 root root 165936 Jul 15 2015 /lib/i386-linux-gnu/libnl-3.a lrwxrwxrwx 1 root root 19 Jul 15 2015 /lib/i386-linux-gnu/libnl-3.so -> libnl-3.so.200.21.0 lrwxrwxrwx 1 root root 19 Jul 15 2015 /lib/i386-linux-gnu/libnl-3.so.200 -> libnl-3.so.200.21.0 -rw-r--r-- 1 root root 132852 Jul 15 2015 /lib/i386-linux-gnu/libnl-3.so.200.21.0 $ ls -l /lib/i386-linux-gnu/*libdl* -rw-r--r-- 1 root root 13808 Feb 16 14:06 /lib/i386-linux-gnu/libdl-2.21.so lrwxrwxrwx 1 root root 13 Feb 16 14:06 /lib/i386-linux-gnu/libdl.so.2 -> libdl-2.21.so From irwin at beluga.phys.uvic.ca Fri Apr 22 17:08:17 2016 From: irwin at beluga.phys.uvic.ca (Alan W. Irwin) Date: Fri, 22 Apr 2016 14:08:17 -0700 (PDT) Subject: [CMake] Finding 32bit libs on 64bit Ubuntu install In-Reply-To: References: Message-ID: On 2016-04-22 14:59-0400 Nick Deubert wrote: > Hey everyone, I am trying to build and link some 32bit binaries on > Ubuntu 15.10 64bit, but no matter what combination of arguments I give > FIND_LIBRARY I cannot get it to use the 32bit libs. I have been > scouring the mailing lists and came up with all these things to try > but nothing has worked so far. I am using cmake 3.0.2. Please let me > know what I am missing. Thanks in advance for your help. CMake 3.0.2 is pretty old, and there were some find and other issues for early CMake-3 versions. I don't know whether any of those issues are relevant to the issue you are discussing. Nevertheless, as an experiment (and to make sure your eventual solution works for the latest CMake) I would suggest you try building and using the latest released version of CMake, 3.5.2, to see if that makes any difference. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ From eldlistmailingz at tropicsoft.com Fri Apr 22 18:47:11 2016 From: eldlistmailingz at tropicsoft.com (Edward Diener) Date: Fri, 22 Apr 2016 18:47:11 -0400 Subject: [CMake] Using Clang + Ninja on Windows? In-Reply-To: <8D981219EEA621479C112DA9BDC39A8E6367D3B7@EXMBS1.ad.igd.fraunhofer.de> References: <8D981219EEA621479C112DA9BDC39A8E6367D33D@EXMBS1.ad.igd.fraunhofer.de> <8D981219EEA621479C112DA9BDC39A8E6367D3B7@EXMBS1.ad.igd.fraunhofer.de> Message-ID: On 4/22/2016 4:51 AM, Mueller-Roemer, Johannes Sebastian wrote: > It is true that there is no official bundled installer with both, but > the official installer works just fine with mingw as long as you pass in > the correct target to clang(++) > > For example > > clang++ --target=x86_64-w64-mingw32 test.cpp > > However, it assumes that mingw64 is installed under C:/mingw64 (the > default location, it?ll work with a junction point though). As of clang 3.7 there is no need to have a hardcoded mingw directory. You just need to have an appropriate mingw(-64)/gcc in your PATH. Also all distributed versions of clang 3.4 through 3.7 for Windows default to targeting mingw(-64)/gcc and not VC++. Only with 3.8 is the Windows release defaulting to targeting VC++. From zcsd2012 at gmail.com Sat Apr 23 08:42:20 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Sat, 23 Apr 2016 05:42:20 -0700 (MST) Subject: [CMake] How to transfer CMake variable and include other makefile in one makefile which generated by CMake Message-ID: <1461415340829-7593327.post@n2.nabble.com> Hi all, I faced this problem when i converting an existing Makefile to CMake. I have try my best to search this problem in google and stack overflow but finally failed for my poor English.In the existing makefile, the content like as below: var=test_var include(test.mk) What i want to do is convert this makefile into CMakeLists.txt, and after cmake this CMakeLists.txt, i can get a makefile like this. What should i do? Thanks, Chao Zhang -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-transfer-CMake-variable-and-include-other-makefile-in-one-makefile-which-generated-by-CMake-tp7593327.html Sent from the CMake mailing list archive at Nabble.com. From rob.a.mcdonald at gmail.com Sat Apr 23 13:32:15 2016 From: rob.a.mcdonald at gmail.com (Rob McDonald) Date: Sat, 23 Apr 2016 10:32:15 -0700 Subject: [CMake] Version compatibility? Message-ID: Is there a continuation of the CMake version -- feature mapping table? https://cmake.org/Wiki/CMake_Version_Compatibility_Matrix I found this to be quite useful, but need something that continues into 3.X. Rob From rob.a.mcdonald at gmail.com Sat Apr 23 13:44:28 2016 From: rob.a.mcdonald at gmail.com (Rob McDonald) Date: Sat, 23 Apr 2016 10:44:28 -0700 Subject: [CMake] CMAKE_POSITION_INDEPENDENT_CODE Version Message-ID: CMAKE_POSITION_INDEPENDENT_CODE first appears in the documentation for 2.8.9 while CMAKE_POSITION_INDEPENDENT_FLAGS appears in the docs for 2.8.8 -- with the same description. Was this just a documentation typo, or did the name of this variable change from 2.8.8 to 2.8.9? Only the _FLAGS version is tracked in the compatibility matrix on the Wiki... https://cmake.org/Wiki/CMake_Version_Compatibility_Matrix Which should I use to work with the widest range of CMake versions? Rob From annulen at yandex.ru Sat Apr 23 15:33:05 2016 From: annulen at yandex.ru (Konstantin Tokarev) Date: Sat, 23 Apr 2016 22:33:05 +0300 Subject: [CMake] Assign large C++ source to separate ninja pool Message-ID: <6092161461439985@web24g.yandex.ru> Hello, In Ninja documentation on pools feature there is an example of separate heavy_object_pool [1]. Is it possible to use this feature with cmake? Use case is to avoid parallel compilation of N large sources, while compilation of 1 large and N-1 small sources is OK. [1] https://ninja-build.org/manual.html#ref_pool -- Regards, Konstantin From zcsd2012 at gmail.com Sun Apr 24 23:13:48 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Sun, 24 Apr 2016 20:13:48 -0700 (MST) Subject: [CMake] Need a example to use dll in vs Message-ID: <1461554028300-7593331.post@n2.nabble.com> Hi all, I faced a problem when i migrate a project from Linux to windows for the visual stdio seem can not use dll directly. I look through a number of material and known i seem should use IMPORTED in add_library(...), but i can not find a practical example about how to use it. Could you please give me one or some? BTW the dll lib seem could be used in Mingw makefile on windows. Thanks, Chao Zhang -- View this message in context: http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331.html Sent from the CMake mailing list archive at Nabble.com. From scott at towel42.com Mon Apr 25 01:16:57 2016 From: scott at towel42.com (Scott Aron Bloom) Date: Mon, 25 Apr 2016 05:16:57 +0000 Subject: [CMake] Need a example to use dll in vs In-Reply-To: <1461554028300-7593331.post@n2.nabble.com> References: <1461554028300-7593331.post@n2.nabble.com> Message-ID: When I am building DLLs I tend to use an "install step" as part of my cmake process. Then I make sure the builds' install area is in the path of the application. The issue may be your EXE cant find the DLL in its path. Scott -----Original Message----- From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Chaos Zhang Sent: Sunday, April 24, 2016 8:14 PM To: cmake at cmake.org Subject: [CMake] Need a example to use dll in vs Hi all, I faced a problem when i migrate a project from Linux to windows for the visual stdio seem can not use dll directly. I look through a number of material and known i seem should use IMPORTED in add_library(...), but i can not find a practical example about how to use it. Could you please give me one or some? BTW the dll lib seem could be used in Mingw makefile on windows. Thanks, Chao Zhang -- View this message in context: http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331.html Sent from the CMake mailing list archive at Nabble.com. -- 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 From zcsd2012 at gmail.com Mon Apr 25 01:31:32 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Sun, 24 Apr 2016 22:31:32 -0700 (MST) Subject: [CMake] Need a example to use dll in vs In-Reply-To: References: <1461554028300-7593331.post@n2.nabble.com> Message-ID: <1461562292580-7593333.post@n2.nabble.com> Thanks for your reply Mr Scott, but my project worked well on Linux and i am sure the path is right. This question has been asked long before, as below: On Sat, Jul 24, 2010 at 11:00 PM, John Drescher wrote: >>> I know that target_link_libraries can be used to link a .lib , >>> >>> but how to link a .dll into the project? >>> >>> >> You do not link against a .dll in windows ever. >> > When you create a .dll there is also a small import lib associated > with the dll. You link with that and when the application starts it > searches the path for each dll it needs. > > John And the error was not dll lib was not found but .lib(static lib) was not found. As i knew so far, i think this error is related to windows platform. Scott Aron Bloom-2 wrote > When I am building DLLs I tend to use an "install step" as part of my > cmake process. Then I make sure the builds' install area is in the path > of the application. > > The issue may be your EXE cant find the DLL in its path. > > Scott > > -----Original Message----- > From: CMake [mailto: > cmake-bounces@ > ] On Behalf Of Chaos Zhang > Sent: Sunday, April 24, 2016 8:14 PM > To: > cmake@ > Subject: [CMake] Need a example to use dll in vs > > Hi all, > > I faced a problem when i migrate a project from Linux to windows for the > visual stdio seem can not use dll directly. I look through a number of > material and known i seem should use IMPORTED in add_library(...), but i > can not find a practical example about how to use it. Could you please > give me one or some? BTW the dll lib seem could be used in Mingw makefile > on windows. > > Thanks, > Chao Zhang > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 -- View this message in context: http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331p7593333.html Sent from the CMake mailing list archive at Nabble.com. From zcsd2012 at gmail.com Mon Apr 25 06:14:15 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Mon, 25 Apr 2016 03:14:15 -0700 (MST) Subject: [CMake] Exe file can't find .dll file on windows Message-ID: <1461579255373-7593334.post@n2.nabble.com> Hi, all, At first i was struggled to solve the problem of link shared lib on windows by CMake, and i found solution by using set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES). But when i executed the exe file, an error occurred: "The program can't start because hello_lib.dll is missing from your computer. Try reinstalling to fix this problem." And after i copy hello_lib.dll to the folder of exe file, it worked. Thanks, Chao Zhang -- View this message in context: http://cmake.3232098.n2.nabble.com/Exe-file-can-t-find-dll-file-on-windows-tp7593334.html Sent from the CMake mailing list archive at Nabble.com. From johannes.zarl-zierl at jku.at Mon Apr 25 07:32:52 2016 From: johannes.zarl-zierl at jku.at (Johannes Zarl-Zierl) Date: Mon, 25 Apr 2016 13:32:52 +0200 Subject: [CMake] Version compatibility? In-Reply-To: References: Message-ID: <1691510.k9CKClWzEx@ersa> Hi Rob, I've stopped working on it when 3.0 came out. Since the whole thing was very much manual work (diff'ing documentation pages and checking whether some change was only better documentation or a real change in cmake), it was too much effort to continue long-term. Johannes On Saturday 23 April 2016 10:32:15 Rob McDonald wrote: > Is there a continuation of the CMake version -- feature mapping table? > > https://cmake.org/Wiki/CMake_Version_Compatibility_Matrix > > I found this to be quite useful, but need something that continues into 3.X. > > Rob From craig.scott at crascit.com Mon Apr 25 08:29:12 2016 From: craig.scott at crascit.com (Craig Scott) Date: Mon, 25 Apr 2016 22:29:12 +1000 Subject: [CMake] Version compatibility? In-Reply-To: <1691510.k9CKClWzEx@ersa> References: <1691510.k9CKClWzEx@ersa> Message-ID: I personally have found myself having to look up to his sort of version info a lot lately. It sounds like others do too. Perhaps a more sustainable approach would be to include the version details in the CMAKE docs themselves. For each command, module, variable, etc. it's documentation could state the version it was added. Some may warrant further info for version(s) where significant changes were made (eg keywords added to a command). Realistically, it would have to be done progressively and obviously with agreement from the Kitware side. It would only work if it became part of the change process whereby any new features or changes must include such version details. It would be interesting to hear what Kitware think of the idea. Any chance? On Monday, 25 April 2016, Johannes Zarl-Zierl wrote: > Hi Rob, > > I've stopped working on it when 3.0 came out. Since the whole thing was > very > much manual work (diff'ing documentation pages and checking whether some > change was only better documentation or a real change in cmake), it was too > much effort to continue long-term. > > Johannes > > On Saturday 23 April 2016 10:32:15 Rob McDonald wrote: > > Is there a continuation of the CMake version -- feature mapping table? > > > > https://cmake.org/Wiki/CMake_Version_Compatibility_Matrix > > > > I found this to be quite useful, but need something that continues into > 3.X. > > > > Rob > > -- > > 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 > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsvanbethlehem at gmail.com Mon Apr 25 09:43:14 2016 From: jsvanbethlehem at gmail.com (Jakob van Bethlehem) Date: Mon, 25 Apr 2016 15:43:14 +0200 Subject: [CMake] Need a example to use dll in vs In-Reply-To: <1461554028300-7593331.post@n2.nabble.com> References: <1461554028300-7593331.post@n2.nabble.com> Message-ID: Hej, You really should provide more detailed information about your project structure, and what is going wrong. There are some subtle differences between Linux/Windows, but not at the level you're referring to. Certainly the IMPORTED property has nothing to do with a platform distinction. IMPORTED libraries work exactly the same on Windows/Linux. There is a very big difference between Linux/Windows though in the sense that on Windows you need to explicitly export symbols you want to be available on the interface of the dll. My first guess from your very limited info is that something is wrong in that area (and if that's the case, you can easily resolve this using the GenerateExportHeader module). But back to my original comment: provide more details on what you are trying to do, and what is failing. Sincerely, Jakob van Bethlehem On Mon, Apr 25, 2016 at 5:13 AM, Chaos Zhang wrote: > Hi all, > > I faced a problem when i migrate a project from Linux to windows for the > visual stdio seem can not use dll directly. I look through a number of > material and known i seem should use IMPORTED in add_library(...), but i > can not find a practical example about how to use it. Could you please give > me one or some? BTW the dll lib seem could be used in Mingw makefile on > windows. > > Thanks, > Chao Zhang > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nilsgladitz at gmail.com Mon Apr 25 09:48:24 2016 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 25 Apr 2016 15:48:24 +0200 Subject: [CMake] Version compatibility? In-Reply-To: References: <1691510.k9CKClWzEx@ersa> Message-ID: <571E2028.1060806@gmail.com> On 04/25/2016 02:29 PM, Craig Scott wrote: > I personally have found myself having to look up to his sort of > version info a lot lately. It sounds like others do too. Perhaps a > more sustainable approach would be to include the version details in > the CMAKE docs themselves. For each command, module, variable, etc. > it's documentation could state the version it was added. Some may > warrant further info for version(s) where significant changes were > made (eg keywords added to a command). Realistically, it would have to > be done progressively and obviously with agreement from the Kitware > side. It would only work if it became part of the change process > whereby any new features or changes must include such version details. > It would be interesting to hear what Kitware think of the idea. Any > chance? I've also made use of such information from time to time but I think it has been the exception and it doesn't normally come up during my regular development workflow. I assume for most projects there is a single cmake_minimum_required(VERSION). Which means to see what is and what isn't available I only have to check that specific version's documentation. I am curious as to what kind of use case results in having to require cross-version information as provided by the compatibility matrix "a lot". Nils -------------- next part -------------- An HTML attachment was scrubbed... URL: From mosra at centrum.cz Mon Apr 25 10:21:26 2016 From: mosra at centrum.cz (=?utf-8?q?Vladim=C3=ADr_Vondru=C5=A1?=) Date: Mon, 25 Apr 2016 16:21:26 +0200 Subject: [CMake] =?utf-8?q?Version_compatibility=3F?= In-Reply-To: <571E2028.1060806@gmail.com> References: , <1691510.k9CKClWzEx@ersa>, <571E2028.1060806@gmail.com> Message-ID: <20160425162126.FCCEE125@centrum.cz> In my case I'm going through changelogs to see what is added in which version. For example I switched to the imported target workflow recently and need to keep backward compatibility all the way back to 2.8.12 (because Ubuntu LTS). There are a lot of features that were added later and are crucial (ALIAS targets, interface compatibility...), so I somehow need to add version-specific workarounds to make the projects working on 2.8.12. The changelogs are pretty useful source of information, but it would be great to have the information directly in the docs to avoid trial and error. Regards mosra ______________________________________________________________ > Od: Nils Gladitz > Komu: Craig Scott , "Johannes Zarl-Zierl" > Datum: 25.04.2016 15:51 > P?edm?t: Re: [CMake] Version compatibility? > > CC: "cmake at cmake.org" >On 04/25/2016 02:29 PM, Craig Scott wrote: >> I personally have found myself having to look up to his sort of >> version info a lot lately. It sounds like others do too. Perhaps a >> more sustainable approach would be to include the version details in >> the CMAKE docs themselves. For each command, module, variable, etc. >> it's documentation could state the version it was added. Some may >> warrant further info for version(s) where significant changes were >> made (eg keywords added to a command). Realistically, it would have to >> be done progressively and obviously with agreement from the Kitware >> side. It would only work if it became part of the change process >> whereby any new features or changes must include such version details. >> It would be interesting to hear what Kitware think of the idea. Any >> chance? > >I've also made use of such information from time to time but I think it >has been the exception and it doesn't normally come up during my regular >development workflow. > >I assume for most projects there is a single >cmake_minimum_required(VERSION). >Which means to see what is and what isn't available I only have to check >that specific version's documentation. > >I am curious as to what kind of use case results in having to require >cross-version information as provided by the compatibility matrix "a lot". > >Nils > > >---------- > >-- > >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 > From mohammedrashadkm at gmail.com Mon Apr 25 13:06:55 2016 From: mohammedrashadkm at gmail.com (Rashad Kanavath) Date: Mon, 25 Apr 2016 19:06:55 +0200 Subject: [CMake] adding parts of build log to dashboard. In-Reply-To: <2803721.KSblf2r5Ia@stryke> References: <2803721.KSblf2r5Ia@stryke> Message-ID: could we inject some files inside Build.xml ? On Thu, Jan 7, 2016 at 5:21 PM, Clinton Stimpson wrote: > On Thursday, January 07, 2016 02:51:18 PM Rashad Kanavath wrote: > > Hello, > > > > How can I include part of my build log to cdash output. Currently cdash > > pickup build errors and warnings. > > > > In the build summary, if there is no build log attached. I think this is > > intentional given the size of build log for some projects. > > > > What I would like to know is , if there is way I can put some logs into > > build summary page via some special cmake settings. I don't may be > setting > > a cmake var ? > > > > My situation is I have a set of add_custom_targets that I used to make > > packages. they produce various ouputs such as processing abc.dll, > creating > > zip archive, adding files to archive etc.. > > > > Is there a way I can include them into the build summary ? > > I don't know how to add them to the build summary. > > What I do for packages is make a test for them, using add_test(). > There are settings to control how much test output you get on cdash. > > Clint > -- Regards, Rashad -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndeubert at gmail.com Mon Apr 25 14:06:43 2016 From: ndeubert at gmail.com (Nick Deubert) Date: Mon, 25 Apr 2016 14:06:43 -0400 Subject: [CMake] Finding 32bit libs on 64bit Ubuntu install In-Reply-To: References: Message-ID: On Fri, Apr 22, 2016 at 5:08 PM, Alan W. Irwin wrote: > On 2016-04-22 14:59-0400 Nick Deubert wrote: > >> Hey everyone, I am trying to build and link some 32bit binaries on >> Ubuntu 15.10 64bit, but no matter what combination of arguments I give >> FIND_LIBRARY I cannot get it to use the 32bit libs. I have been >> scouring the mailing lists and came up with all these things to try >> but nothing has worked so far. I am using cmake 3.0.2. Please let me >> know what I am missing. Thanks in advance for your help. > > > CMake 3.0.2 is pretty old, and there were some find and other issues > for early CMake-3 versions. I don't know whether any of those issues > are relevant to the issue you are discussing. Nevertheless, as an > experiment (and to make sure your eventual solution works for the > latest CMake) I would suggest you try building and using the latest > released version of CMake, 3.5.2, to see if that makes any difference. > > Alan Ok I upgraded to 3.2.2 which is the latest ubuntu 15.10 offers (I will try 16.04 w/3.5.1 soon), but I get the same issue. Is my syntax all correct as far as you can tell? Thanks, Nick From nilsgladitz at gmail.com Mon Apr 25 14:15:44 2016 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 25 Apr 2016 20:15:44 +0200 Subject: [CMake] Finding 32bit libs on 64bit Ubuntu install In-Reply-To: References: Message-ID: <571E5ED0.2040508@gmail.com> On 22.04.2016 20:59, Nick Deubert wrote: > Hey everyone, I am trying to build and link some 32bit binaries on > Ubuntu 15.10 64bit, but no matter what combination of arguments I give > FIND_LIBRARY I cannot get it to use the 32bit libs. I have been > scouring the mailing lists and came up with all these things to try > but nothing has worked so far. I am using cmake 3.0.2. Please let me > know what I am missing. Thanks in advance for your help. > Nick Run cmake e.g. like this: CC="gcc -m32" CXX="g++ -m32" cmake .. Don't try to add -m32 within the project. This way the try_compile() tests that cmake runs will correctly determine that you are building 32-bit and find_library() will use the correct paths. Make sure you start with a fresh build directory. Nils From irwin at beluga.phys.uvic.ca Mon Apr 25 16:01:47 2016 From: irwin at beluga.phys.uvic.ca (Alan W. Irwin) Date: Mon, 25 Apr 2016 13:01:47 -0700 (PDT) Subject: [CMake] Finding 32bit libs on 64bit Ubuntu install In-Reply-To: References: Message-ID: On 2016-04-25 14:06-0400 Nick Deubert wrote: > On Fri, Apr 22, 2016 at 5:08 PM, Alan W. Irwin > wrote: >> On 2016-04-22 14:59-0400 Nick Deubert wrote: >> >>> Hey everyone, I am trying to build and link some 32bit binaries on >>> Ubuntu 15.10 64bit, but no matter what combination of arguments I give >>> FIND_LIBRARY I cannot get it to use the 32bit libs. I have been >>> scouring the mailing lists and came up with all these things to try >>> but nothing has worked so far. I am using cmake 3.0.2. Please let me >>> know what I am missing. Thanks in advance for your help. >> >> >> CMake 3.0.2 is pretty old, and there were some find and other issues >> for early CMake-3 versions. I don't know whether any of those issues >> are relevant to the issue you are discussing. Nevertheless, as an >> experiment (and to make sure your eventual solution works for the >> latest CMake) I would suggest you try building and using the latest >> released version of CMake, 3.5.2, to see if that makes any difference. >> >> Alan > > Ok I upgraded to 3.2.2 which is the latest ubuntu 15.10 offers (I will > try 16.04 w/3.5.1 soon), but I get the same issue. > Is my syntax all correct as far as you can tell? Hi Nick: The syntax is OK _as far as I can tell_, but I did notice one important issue in the libdl information you supplied with your original post which is your 64-bit version of libdl is -- DL_LIBRARY is /usr/lib/x86_64-linux-gnu/libdl.so but there is no libdl.so in your 32-bit directory listings. The closest you come is /lib/i386-linux-gnu/libdl.so.2 -> libdl-2.21.so but that doesn't cut it, and you need a development symlink (provided by the development version of a library package) that defines a 32-bit libdl.so symlink that can be found by CMake. Such symlink would ordinarily be supplied by a Ubuntu development package. I don't have Ubuntu installed myself, but Ubuntu is based on Debian, and for Debian jessie the package name is libc6-dev-i386, and it contains the /usr/lib32/libdl.so symlink. So look for a similarly named package for Ubuntu, verify it contains libdl.so (I did that on Debian using "apt-file search libdl.so") and install it. I haven't looked at the other 32-bit libraries you are trying to find, but I assume there are similar "did not install development version of package" issues for those as well. If installing the correct development versions of the 32-bit libraries does not completely solve your issue, then my advice is 1. When faced with a CMake issue build and install the latest CMake (don't wait for Ubuntu to package it up) to help you illustrate the problem. Building the latest version of CMake is straightforward. You can use an older version of cmake to do that or else use the bootstrap script (mentioned at to build on Unix platforms that don't have any cmake version available. 2. make a really simple test project to illustrate the problem, e.g., cmake_minimum_required(VERSION 3.5.2 FATAL_ERROR) project(test C) find_library(DL_LIBRARY dl) message(STATUS DL_LIBRARY = ${DL_LIBRARY}) I tried that project here (with minimum 3.4.3 since that is the latest version of CMake I happen to have built here [with the bootstrap script by the way]) with the following (good) results: -- The C compiler identification is GNU 4.9.2 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- DL_LIBRARY=/usr/lib/x86_64-linux-gnu/libdl.so -- Configuring done -- Generating done -- Build files have been written to: /tmp/test_cmake/build_dir I assume you would get similarly good results with this simple project in the 32-bit case once you have installed the relevant development packages for your 32-bit libraries, but you should check that. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ From ndeubert at gmail.com Mon Apr 25 16:43:12 2016 From: ndeubert at gmail.com (Nick Deubert) Date: Mon, 25 Apr 2016 16:43:12 -0400 Subject: [CMake] Finding 32bit libs on 64bit Ubuntu install In-Reply-To: References: Message-ID: On Mon, Apr 25, 2016 at 4:01 PM, Alan W. Irwin wrote: > On 2016-04-25 14:06-0400 Nick Deubert wrote: > >> On Fri, Apr 22, 2016 at 5:08 PM, Alan W. Irwin >> wrote: >>> >>> On 2016-04-22 14:59-0400 Nick Deubert wrote: >>> >>>> Hey everyone, I am trying to build and link some 32bit binaries on >>>> Ubuntu 15.10 64bit, but no matter what combination of arguments I give >>>> FIND_LIBRARY I cannot get it to use the 32bit libs. I have been >>>> scouring the mailing lists and came up with all these things to try >>>> but nothing has worked so far. I am using cmake 3.0.2. Please let me >>>> know what I am missing. Thanks in advance for your help. >>> >>> >>> >>> CMake 3.0.2 is pretty old, and there were some find and other issues >>> for early CMake-3 versions. I don't know whether any of those issues >>> are relevant to the issue you are discussing. Nevertheless, as an >>> experiment (and to make sure your eventual solution works for the >>> latest CMake) I would suggest you try building and using the latest >>> released version of CMake, 3.5.2, to see if that makes any difference. >>> >>> Alan >> >> >> Ok I upgraded to 3.2.2 which is the latest ubuntu 15.10 offers (I will >> try 16.04 w/3.5.1 soon), but I get the same issue. > > >> Is my syntax all correct as far as you can tell? > > > Hi Nick: > > The syntax is OK _as far as I can tell_, but I did notice one important > issue in the libdl information you supplied with your original post which is > your 64-bit version of libdl is > > -- DL_LIBRARY is /usr/lib/x86_64-linux-gnu/libdl.so > > but there is no libdl.so in your 32-bit directory listings. The closest > you come is > > /lib/i386-linux-gnu/libdl.so.2 -> libdl-2.21.so > > but that doesn't cut it, and you need a development symlink (provided > by the development version of a library package) that defines a 32-bit > libdl.so symlink that can be found by CMake. Such symlink would > ordinarily be supplied by a Ubuntu development package. I don't have > Ubuntu installed myself, but Ubuntu is based on Debian, and for Debian > jessie the package name is libc6-dev-i386, and it contains the > > /usr/lib32/libdl.so > > symlink. So look for a similarly named package for Ubuntu, verify it > contains > libdl.so (I did that on Debian using "apt-file search libdl.so") and > install it. Solved! I did have the 32bit-dev libraries installed but your tip made me realize the plain .so files are installed into /usr/lib/i386-linux-gnu and not /lib/i386-linux-gnu. As soon as I switched to that path it is finding all the right libs. I didn't realize cmake wouldn't parse the version numbers, so that is a very good thing to know. Thanks for your help! Nick From craig.scott at crascit.com Mon Apr 25 17:49:14 2016 From: craig.scott at crascit.com (Craig Scott) Date: Tue, 26 Apr 2016 07:49:14 +1000 Subject: [CMake] Version compatibility? In-Reply-To: <571E2028.1060806@gmail.com> References: <1691510.k9CKClWzEx@ersa> <571E2028.1060806@gmail.com> Message-ID: In my case, I work with a large code base that spans many projects with various interdependencies. Some of that code base is quite old and would benefit from updating to more modern CMake features, but some parts of the code I'm not free to update. For these cases, I need to understand what CMake version a particular feature was introduced before I can start using it and also to put in place guards so that the updated project can still be used with older projects that don't want or can't yet move to using a newer CMake version. In an ideal world, everyone would just move to the latest current CMake release and our projects could use whatever CMake features they like, but that's not the reality we live in, for various reasons. ;) On a personal level, I also write a blog which frequently covers CMake features. I find I am always having to go check what version a particular CMake feature was introduced so that I can highlight to my readers what minimum CMake version they need to set. Like Vladimir, this usually requires me to go through release notes or older versions of the CMake docs to work out when that particular command, variable, module, etc. was added. It would be great if the latest version's documentation always had that information instead, it would be more reliable and certainly more convenient. On Mon, Apr 25, 2016 at 11:48 PM, Nils Gladitz wrote: > On 04/25/2016 02:29 PM, Craig Scott wrote: > > I personally have found myself having to look up to his sort of version > info a lot lately. It sounds like others do too. Perhaps a more > sustainable approach would be to include the version details in the CMAKE > docs themselves. For each command, module, variable, etc. it's > documentation could state the version it was added. Some may warrant > further info for version(s) where significant changes were made (eg > keywords added to a command). Realistically, it would have to be done > progressively and obviously with agreement from the Kitware side. It would > only work if it became part of the change process whereby any new features > or changes must include such version details. It would be interesting to > hear what Kitware think of the idea. Any chance? > > > I've also made use of such information from time to time but I think it > has been the exception and it doesn't normally come up during my regular > development workflow. > > I assume for most projects there is a single > cmake_minimum_required(VERSION). > Which means to see what is and what isn't available I only have to check > that specific version's documentation. > > I am curious as to what kind of use case results in having to require > cross-version information as provided by the compatibility matrix "a lot". > > Nils > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From zcsd2012 at gmail.com Mon Apr 25 21:01:25 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Mon, 25 Apr 2016 18:01:25 -0700 (MST) Subject: [CMake] How to link shared lib on windows (visual studio 2014). Message-ID: <1461632485342-7593346.post@n2.nabble.com> Hi, I faced this problem when i try built a shared lib and linked it on windows. The structure of my project as below: -test_dir/ -sub_hello/ CMakeLists.txt hello.c -top/ main.c CMakeLists.txt CMakeLists.txt The content of each file: ?test_dir/CMakeLists.txt: PROJECT(TESTLIB) add_subdirectory(sub_hello sub_hello) add_subdirectory(top top) ?test_dir/sub_hello/CMakeLists.txt: message("message from sub_hello") add_library(hello_lib SHARED hello.c) ?test_dir/top/CMakeLists.txt: include_directories(../sub_hello) add_executable(main main.c) target_link_libraries(main hello_lib) ?test_dir/sub_hello/hello.c? #include void HelloFunc() { printf("###hello###\n"); } ?test_dir/top/main.c: int main() { HelloFunc(); return 0; } After i cmake this project, generated .sln and .proj files, then i built it and i get an error in vs: Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. Then i look thorough and found a solution: Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file test_dir/sub_hello/hello.c Then i built this solution again, this time it success, and hello_lib.lib and main.exe was generated. But when i try to run main.exe, an error occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of main.exe, and it worked well. There are two questions i could not figure out: ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly, and use a .lib to record the .dll's entrance and location. ?How to solve the problem of main.exe can not find .dll file. Best regards, Chao Zhang -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html Sent from the CMake mailing list archive at Nabble.com. From zcsd2012 at gmail.com Mon Apr 25 21:07:28 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Mon, 25 Apr 2016 18:07:28 -0700 (MST) Subject: [CMake] Need a example to use dll in vs In-Reply-To: References: <1461554028300-7593331.post@n2.nabble.com> Message-ID: <1461632848160-7593347.post@n2.nabble.com> Jakob van Bethlehem wrote > Hej, > > You really should provide more detailed information about your project > structure, and what is going wrong. There are some subtle differences > between Linux/Windows, but not at the level you're referring to. Certainly > the IMPORTED property has nothing to do with a platform distinction. > IMPORTED libraries work exactly the same on Windows/Linux. > > There is a very big difference between Linux/Windows though in the sense > that on Windows you need to explicitly export symbols you want to be > available on the interface of the dll. My first guess from your very > limited info is that something is wrong in that area (and if that's the > case, you can easily resolve this using the GenerateExportHeader module). > > But back to my original comment: provide more details on what you are > trying to do, and what is failing. > > Sincerely, > Jakob van Bethlehem > > On Mon, Apr 25, 2016 at 5:13 AM, Chaos Zhang < > zcsd2012@ > > wrote: > >> Hi all, >> >> I faced a problem when i migrate a project from Linux to windows for the >> visual stdio seem can not use dll directly. I look through a number of >> material and known i seem should use IMPORTED in add_library(...), but i >> can not find a practical example about how to use it. Could you please >> give >> me one or some? BTW the dll lib seem could be used in Mingw makefile on >> windows. >> >> Thanks, >> Chao Zhang >> >> >> >> -- >> View this message in context: >> http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331.html >> Sent from the CMake mailing list archive at Nabble.com. >> -- >> >> 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 > Thanks for your advice, i have add a new topic named "How to link shared > lib on windows (visual studio 2014)", sincerely look forward to your > reply. ^_^ > > Chao > > 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 -- View this message in context: http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331p7593347.html Sent from the CMake mailing list archive at Nabble.com. From d3ck0r at gmail.com Mon Apr 25 21:33:16 2016 From: d3ck0r at gmail.com (J Decker) Date: Mon, 25 Apr 2016 18:33:16 -0700 Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: <1461632485342-7593346.post@n2.nabble.com> References: <1461632485342-7593346.post@n2.nabble.com> Message-ID: Add __declspec(dllexport) before void HelloFunc() On Apr 25, 2016 6:01 PM, "Chaos Zhang" wrote: > Hi, > > I faced this problem when i try built a shared lib and linked it on > windows. The structure of my project as below: > -test_dir/ > -sub_hello/ > CMakeLists.txt > hello.c > -top/ > main.c > CMakeLists.txt > CMakeLists.txt > > The content of each file: > ?test_dir/CMakeLists.txt: > PROJECT(TESTLIB) > add_subdirectory(sub_hello sub_hello) > add_subdirectory(top top) > > ?test_dir/sub_hello/CMakeLists.txt: > message("message from sub_hello") > add_library(hello_lib SHARED hello.c) > > ?test_dir/top/CMakeLists.txt: > include_directories(../sub_hello) > add_executable(main main.c) > target_link_libraries(main hello_lib) > > ?test_dir/sub_hello/hello.c? > #include > void HelloFunc() > { > printf("###hello###\n"); > } > > ?test_dir/top/main.c: > int main() > { > HelloFunc(); > return 0; > } > > After i cmake this project, generated .sln and .proj files, then i built it > and i get an error in vs: > > Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" > > In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. > Then i look thorough and found a solution: > > Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file > test_dir/sub_hello/hello.c > > Then i built this solution again, this time it success, and hello_lib.lib > and main.exe was generated. But when i try to run main.exe, an error > occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of > main.exe, and it worked well. > > There are two questions i could not figure out: > ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with > "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly, > and use a .lib to record the .dll's entrance and location. > ?How to solve the problem of main.exe can not find .dll file. > > Best regards, > Chao Zhang > > > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From calebwherry at gmail.com Mon Apr 25 21:41:22 2016 From: calebwherry at gmail.com (J. Caleb Wherry) Date: Mon, 25 Apr 2016 21:41:22 -0400 Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: <1461632485342-7593346.post@n2.nabble.com> References: <1461632485342-7593346.post@n2.nabble.com> Message-ID: (1) You typically want to define the entry point in the source itself. You can use the 'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS' in CMake but you usually do something like this in the source: #ifdef WIN32 #define PUBLIC_API __declspec(dllexport) #else #define PUBLIC_API #endif PUBLIC_API void HelloFunc(); That way when you are building a shared lib on windows it will export those symbols which in turn creates the .lib. Without the exported symbols, you will not have an import lib. (2) The missing DLL is a pain that you are just going to have to deal with unless you want to do a bunch of voodoo with the registry or copy the DLLs. Typically, there are POST_BUILD steps that copy the needed DLLs into the same directory as the exe. There are many stackoverflow questions dealing with this, first one googled here: http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory -Caleb On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang wrote: > Hi, > > I faced this problem when i try built a shared lib and linked it on > windows. The structure of my project as below: > -test_dir/ > -sub_hello/ > CMakeLists.txt > hello.c > -top/ > main.c > CMakeLists.txt > CMakeLists.txt > > The content of each file: > ?test_dir/CMakeLists.txt: > PROJECT(TESTLIB) > add_subdirectory(sub_hello sub_hello) > add_subdirectory(top top) > > ?test_dir/sub_hello/CMakeLists.txt: > message("message from sub_hello") > add_library(hello_lib SHARED hello.c) > > ?test_dir/top/CMakeLists.txt: > include_directories(../sub_hello) > add_executable(main main.c) > target_link_libraries(main hello_lib) > > ?test_dir/sub_hello/hello.c? > #include > void HelloFunc() > { > printf("###hello###\n"); > } > > ?test_dir/top/main.c: > int main() > { > HelloFunc(); > return 0; > } > > After i cmake this project, generated .sln and .proj files, then i built it > and i get an error in vs: > > Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" > > In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. > Then i look thorough and found a solution: > > Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file > test_dir/sub_hello/hello.c > > Then i built this solution again, this time it success, and hello_lib.lib > and main.exe was generated. But when i try to run main.exe, an error > occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of > main.exe, and it worked well. > > There are two questions i could not figure out: > ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with > "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly, > and use a .lib to record the .dll's entrance and location. > ?How to solve the problem of main.exe can not find .dll file. > > Best regards, > Chao Zhang > > > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 -- J. Caleb Wherry *Scientific Software Engineer* http://www.calebwherry.com +1 (615) 708-5651 calebwherry at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Mon Apr 25 21:42:25 2016 From: craig.scott at crascit.com (Craig Scott) Date: Tue, 26 Apr 2016 11:42:25 +1000 Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: References: <1461632485342-7593346.post@n2.nabble.com> Message-ID: Also see the GenerateExportHeader module which can handle much of this for you in a more platform independent way. The examples in the docs talk about classes, but it can also be applied to functions. On Tue, Apr 26, 2016 at 11:33 AM, J Decker wrote: > Add __declspec(dllexport) before void HelloFunc() > On Apr 25, 2016 6:01 PM, "Chaos Zhang" wrote: > >> Hi, >> >> I faced this problem when i try built a shared lib and linked it on >> windows. The structure of my project as below: >> -test_dir/ >> -sub_hello/ >> CMakeLists.txt >> hello.c >> -top/ >> main.c >> CMakeLists.txt >> CMakeLists.txt >> >> The content of each file: >> ?test_dir/CMakeLists.txt: >> PROJECT(TESTLIB) >> add_subdirectory(sub_hello sub_hello) >> add_subdirectory(top top) >> >> ?test_dir/sub_hello/CMakeLists.txt: >> message("message from sub_hello") >> add_library(hello_lib SHARED hello.c) >> >> ?test_dir/top/CMakeLists.txt: >> include_directories(../sub_hello) >> add_executable(main main.c) >> target_link_libraries(main hello_lib) >> >> ?test_dir/sub_hello/hello.c? >> #include >> void HelloFunc() >> { >> printf("###hello###\n"); >> } >> >> ?test_dir/top/main.c: >> int main() >> { >> HelloFunc(); >> return 0; >> } >> >> After i cmake this project, generated .sln and .proj files, then i built >> it >> and i get an error in vs: >> >> Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" >> >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. >> Then i look thorough and found a solution: >> >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file >> test_dir/sub_hello/hello.c >> >> Then i built this solution again, this time it success, and hello_lib.lib >> and main.exe was generated. But when i try to run main.exe, an error >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder >> of >> main.exe, and it worked well. >> >> There are two questions i could not figure out: >> ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with >> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly, >> and use a .lib to record the .dll's entrance and location. >> ?How to solve the problem of main.exe can not find .dll file. >> >> Best regards, >> Chao Zhang >> >> >> >> >> >> -- >> View this message in context: >> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html >> Sent from the CMake mailing list archive at Nabble.com. >> -- >> >> 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 > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From d3ck0r at gmail.com Mon Apr 25 22:02:53 2016 From: d3ck0r at gmail.com (J Decker) Date: Mon, 25 Apr 2016 19:02:53 -0700 Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: References: <1461632485342-7593346.post@n2.nabble.com> Message-ID: On Apr 25, 2016 6:41 PM, "J. Caleb Wherry" wrote: > > (1) > > You typically want to define the entry point in the source itself. You can use the 'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS' in CMake but you usually do something like this in the source: > > #ifdef WIN32 > #define PUBLIC_API __declspec(dllexport) > #else > #define PUBLIC_API > #endif > > PUBLIC_API void HelloFunc(); > > That way when you are building a shared lib on windows it will export those symbols which in turn creates the .lib. Without the exported symbols, you will not have an import lib. > > (2) > > The missing DLL is a pain that you are just going to have to deal with unless you want to do a bunch of voodoo with the registry or copy the DLLs. Typically, there are POST_BUILD steps that copy the needed DLLs into the same directory as the exe. There are many stackoverflow questions dealing with this, first one googled here: > Could just set the path environment variable... No registry hack.. Or include install rules and just build install before running. > http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory > > -Caleb > > > On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang wrote: >> >> Hi, >> >> I faced this problem when i try built a shared lib and linked it on >> windows. The structure of my project as below: >> -test_dir/ >> -sub_hello/ >> CMakeLists.txt >> hello.c >> -top/ >> main.c >> CMakeLists.txt >> CMakeLists.txt >> >> The content of each file: >> ?test_dir/CMakeLists.txt: >> PROJECT(TESTLIB) >> add_subdirectory(sub_hello sub_hello) >> add_subdirectory(top top) >> >> ?test_dir/sub_hello/CMakeLists.txt: >> message("message from sub_hello") >> add_library(hello_lib SHARED hello.c) >> >> ?test_dir/top/CMakeLists.txt: >> include_directories(../sub_hello) >> add_executable(main main.c) >> target_link_libraries(main hello_lib) >> >> ?test_dir/sub_hello/hello.c? >> #include >> void HelloFunc() >> { >> printf("###hello###\n"); >> } >> >> ?test_dir/top/main.c: >> int main() >> { >> HelloFunc(); >> return 0; >> } >> >> After i cmake this project, generated .sln and .proj files, then i built it >> and i get an error in vs: >> >> Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" >> >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. >> Then i look thorough and found a solution: >> >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file >> test_dir/sub_hello/hello.c >> >> Then i built this solution again, this time it success, and hello_lib.lib >> and main.exe was generated. But when i try to run main.exe, an error >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of >> main.exe, and it worked well. >> >> There are two questions i could not figure out: >> ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with >> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly, >> and use a .lib to record the .dll's entrance and location. >> ?How to solve the problem of main.exe can not find .dll file. >> >> Best regards, >> Chao Zhang >> >> >> >> >> >> -- >> View this message in context: http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html >> Sent from the CMake mailing list archive at Nabble.com. >> -- >> >> 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 > > > > > -- > J. Caleb Wherry > Scientific Software Engineer > > http://www.calebwherry.com > +1 (615) 708-5651 > calebwherry at gmail.com > > -- > > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From calebwherry at gmail.com Mon Apr 25 22:29:24 2016 From: calebwherry at gmail.com (J. Caleb Wherry) Date: Mon, 25 Apr 2016 22:29:24 -0400 Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: References: <1461632485342-7593346.post@n2.nabble.com> Message-ID: Altering the path, updating the registry, or having a custom install step that installs into a build location are all options that aren't scalable since they apply specifically to the one project. Paths would get huge if this was to be done in practice for multiple projects. Also, the OP seems to building from VS so being able to press F5 and everything just work is nice. Adding a POST_BULLD step that copies the DLL to the build location of the exe is the best way to solve the problem. Lastly, adding an install step just muddles what "install" means, IMO. You aren't really installing anything, you are just building a project and you want it to run after building. Installing brings a lot more baggage and using it here seems like a bad idea. -Caleb On Monday, April 25, 2016, J Decker wrote: > > On Apr 25, 2016 6:41 PM, "J. Caleb Wherry" > wrote: > > > > (1) > > > > You typically want to define the entry point in the source itself. You > can use the 'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS' in CMake but you usually do > something like this in the source: > > > > #ifdef WIN32 > > #define PUBLIC_API __declspec(dllexport) > > #else > > #define PUBLIC_API > > #endif > > > > PUBLIC_API void HelloFunc(); > > > > That way when you are building a shared lib on windows it will export > those symbols which in turn creates the .lib. Without the exported symbols, > you will not have an import lib. > > > > (2) > > > > The missing DLL is a pain that you are just going to have to deal with > unless you want to do a bunch of voodoo with the registry or copy the DLLs. > Typically, there are POST_BUILD steps that copy the needed DLLs into the > same directory as the exe. There are many stackoverflow questions dealing > with this, first one googled here: > > > > Could just set the path environment variable... No registry hack.. Or > include install rules and just build install before running. > > > http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory > > > > -Caleb > > > > > > On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang > wrote: > >> > >> Hi, > >> > >> I faced this problem when i try built a shared lib and linked it on > >> windows. The structure of my project as below: > >> -test_dir/ > >> -sub_hello/ > >> CMakeLists.txt > >> hello.c > >> -top/ > >> main.c > >> CMakeLists.txt > >> CMakeLists.txt > >> > >> The content of each file: > >> ?test_dir/CMakeLists.txt: > >> PROJECT(TESTLIB) > >> add_subdirectory(sub_hello sub_hello) > >> add_subdirectory(top top) > >> > >> ?test_dir/sub_hello/CMakeLists.txt: > >> message("message from sub_hello") > >> add_library(hello_lib SHARED hello.c) > >> > >> ?test_dir/top/CMakeLists.txt: > >> include_directories(../sub_hello) > >> add_executable(main main.c) > >> target_link_libraries(main hello_lib) > >> > >> ?test_dir/sub_hello/hello.c? > >> #include > >> void HelloFunc() > >> { > >> printf("###hello###\n"); > >> } > >> > >> ?test_dir/top/main.c: > >> int main() > >> { > >> HelloFunc(); > >> return 0; > >> } > >> > >> After i cmake this project, generated .sln and .proj files, then i > built it > >> and i get an error in vs: > >> > >> Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" > >> > >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. > >> Then i look thorough and found a solution: > >> > >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file > >> test_dir/sub_hello/hello.c > >> > >> Then i built this solution again, this time it success, and > hello_lib.lib > >> and main.exe was generated. But when i try to run main.exe, an error > >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the > folder of > >> main.exe, and it worked well. > >> > >> There are two questions i could not figure out: > >> ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with > >> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll > directly, > >> and use a .lib to record the .dll's entrance and location. > >> ?How to solve the problem of main.exe can not find .dll file. > >> > >> Best regards, > >> Chao Zhang > >> > >> > >> > >> > >> > >> -- > >> View this message in context: > http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html > >> Sent from the CMake mailing list archive at Nabble.com. > >> -- > >> > >> 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 > > > > > > > > > > -- > > J. Caleb Wherry > > Scientific Software Engineer > > > > http://www.calebwherry.com > > +1 (615) 708-5651 > > calebwherry at gmail.com > > > > > -- > > > > 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 > -- Sent from my iPhone 4s -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhongle at proplussolution.com Mon Apr 25 22:37:06 2016 From: zhongle at proplussolution.com (vakano) Date: Mon, 25 Apr 2016 19:37:06 -0700 (MST) Subject: [CMake] Compiling configuration set for vs project Message-ID: <1461638226299-7593353.post@n2.nabble.com> Hi, I am generating a vcproj and sln project for windows VS2015, do I need to set each compiling configuration in cmakelist? I am doing nothing special for this in current cmakelist, but the generated vcproj looks like already contain with compiling info eg:Debug x64, Release x64, MinSizeRel x64, RelWithDebInfo x64. Above config info should be generated automatically by cmake, no need to set in cmakelist manually right? Thanks, Le -- View this message in context: http://cmake.3232098.n2.nabble.com/Compiling-configuration-set-for-vs-project-tp7593353.html Sent from the CMake mailing list archive at Nabble.com. From calebwherry at gmail.com Mon Apr 25 23:20:01 2016 From: calebwherry at gmail.com (J. Caleb Wherry) Date: Mon, 25 Apr 2016 23:20:01 -0400 Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: <1461632485342-7593346.post@n2.nabble.com> References: <1461632485342-7593346.post@n2.nabble.com> Message-ID: (Shameless plug ahead) If you want to see a working example of what I said above, you can check out my ExampleCMakeProject: https://github.com/calebwherry/example-cmake-project It is currently being built and tested on TravisCI (Linux + Mac [GGC5 and Clang3.7]) and Appveyor (Windows [VS2015]) and provides a simple example of how to write/structure CMake for cross-platform C/C++ projects. You can ignore the python wrapper if you want, it just makes working with the CMake exe and system builds easier (calculates core counts, creates directories for build, nicer CLI options, etc) since I find the options to CMake to be very... verbose. The POST_BUILD example is here: https://github.com/calebwherry/example-cmake-project/blob/master/src/app/test-app/CMakeLists.txt If you really are looking to get a one-off project working, Decker's recommendation about PATH modification is easiest. It's just not something I think is viable in the long run and doesn't work as an actual solution to the problem if you are trying to solve it for many projects. -Caleb On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang wrote: > Hi, > > I faced this problem when i try built a shared lib and linked it on > windows. The structure of my project as below: > -test_dir/ > -sub_hello/ > CMakeLists.txt > hello.c > -top/ > main.c > CMakeLists.txt > CMakeLists.txt > > The content of each file: > ?test_dir/CMakeLists.txt: > PROJECT(TESTLIB) > add_subdirectory(sub_hello sub_hello) > add_subdirectory(top top) > > ?test_dir/sub_hello/CMakeLists.txt: > message("message from sub_hello") > add_library(hello_lib SHARED hello.c) > > ?test_dir/top/CMakeLists.txt: > include_directories(../sub_hello) > add_executable(main main.c) > target_link_libraries(main hello_lib) > > ?test_dir/sub_hello/hello.c? > #include > void HelloFunc() > { > printf("###hello###\n"); > } > > ?test_dir/top/main.c: > int main() > { > HelloFunc(); > return 0; > } > > After i cmake this project, generated .sln and .proj files, then i built it > and i get an error in vs: > > Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" > > In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. > Then i look thorough and found a solution: > > Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file > test_dir/sub_hello/hello.c > > Then i built this solution again, this time it success, and hello_lib.lib > and main.exe was generated. But when i try to run main.exe, an error > occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of > main.exe, and it worked well. > > There are two questions i could not figure out: > ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with > "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly, > and use a .lib to record the .dll's entrance and location. > ?How to solve the problem of main.exe can not find .dll file. > > Best regards, > Chao Zhang > > > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 -- J. Caleb Wherry *Scientific Software Engineer* http://www.calebwherry.com +1 (615) 708-5651 calebwherry at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Nils.Rathmann at dwd.de Tue Apr 26 03:41:22 2016 From: Nils.Rathmann at dwd.de (Nils Rathmann) Date: Tue, 26 Apr 2016 09:41:22 +0200 Subject: [CMake] How to check if Eclipse CDT4 generated project is set up correctly? In-Reply-To: <2155905.c0aDOjszdI@tuxedo.neundorf.net> References: <5714F5F0.6050505@exch.dwd.de> <2155905.c0aDOjszdI@tuxedo.neundorf.net> Message-ID: <571F1BA2.1050904@exch.dwd.de> Hi Martin, Thanks, I had a look at the marketplace and tried the available plugins. I already use CMakeEd for syntax highlighting and auto-completion while editing cmake files, but the other options seem to me like an alternative to the cmake generated Eclipse project. cmake4eclipse is a good simplification when I want to keep the filesystem structure in my project view. This is how I did it before, but I wrote an external script, integrated as external tool in eclipse. The plugin is more convenient. (when you found out how to use it :-) ) From my point of view, the CMakeBuilder is not required, when you manage to integrate cmake-gui as make target, like the CDT generator does. I would like to understand the cmake created project, because it seems to be a good choice for the Eclipse integration. Hence, do you or does anyone has an idea what the plan for the virtual directories "CMake Rules", "Object Files" and "Ressources" was. Beside the obvious expectation of their meaning, they are still empty and I am not able to get them filled. Thank you, Nils Date: Fri, 22 Apr 2016 20:33:47 +0200 From: Martin Weber To:cmake at cmake.org Subject: Re: [CMake] How to check if Eclipse CDT4 generated project is set up correctly? Message-ID: <3667406.FPWffH5mkm at linux> Content-Type: text/plain; charset="us-ascii" Am Freitag, 22. April 2016, 13:28:33 schrieb Nils Rathmann: > Hi Alex, > thanks for the details. I managed to add the header files as intended > and do have the targets you described, but the virtual directories > "CMake Rules", "Object Files" and "Ressources" of each Target > subdirectory are still empty. What is the intention of these virtual > directories? Hi Nils, the Eclipse Marketplace has some plugins that help you to work with cmake in Eclipse. Just search for 'cmake'... Martin Am 20.04.2016 um 22:14 schrieb Alexander Neundorf: > On Monday, April 18, 2016 16:57:52 Nils Rathmann wrote: >> Hi, >> when I setup with the Eclipse CDT4 generator, as described here: >> https://cmake.org/Wiki/Eclipse_CDT4_Generator4 >> >> my [Targets] folder contains virtual folders for CMakeRules, Header >> Files, Object Files, Resources and Source Files, > Yes, those are the standard groups created by cmake. > >> but only the source files folder is filled. > If you list also the header files in the sources for a target, they will > appear in the [Header Files] group. > >> The other folders are always empty, even if I >> build the target or the whole project. Is there a documentation where I >> can see how a generated Eclipse project should look like? When I compare >> my project with the sample screenshot in the wiki linked above, it looks >> totally different (mine has a lot of virtual folders like Subprojects, >> Targets, ...) > you should have a [Source directory] virtual folder pointing to > ${CMAKE_SOURCE_DIR}. > You should have a virtual folder [Subprojects], with one subdir for every > project()-call in your project. > > The "Make targets" tab should have some global targets to build (like all, > clean, rebuild_cache) and a "Build" and "Clean" make target for every target. > > Is this so ? > > Alex > From magnus at therning.org Tue Apr 26 04:43:36 2016 From: magnus at therning.org (Magnus Therning) Date: Tue, 26 Apr 2016 10:43:36 +0200 Subject: [CMake] How to set link option In-Reply-To: <1461244703147-7593307.post@n2.nabble.com> References: <1461244703147-7593307.post@n2.nabble.com> Message-ID: <8760v4u5dz.fsf@sobel.cipherstone.com> vakano writes: > Hi, > > I have some link option as below: > > -Wl, -rpath, ${PROJECT_TOP}/dist ../proj_a/lib_a.a -lb -Wl, --whole-archive > ../proj_c/lib_c.a What have you tried? /M -- Magnus Therning OpenPGP: 0x927912051716CE39 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus McBryan's Law: You can't make it better until you make it work. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 800 bytes Desc: not available URL: From jsvanbethlehem at gmail.com Tue Apr 26 05:18:10 2016 From: jsvanbethlehem at gmail.com (Jakob van Bethlehem) Date: Tue, 26 Apr 2016 11:18:10 +0200 Subject: [CMake] Cmake 3.5.2 update problem Message-ID: Dear users, Today I tried to bootstrap our app with CMake 3.5.2. Unfortunately it caused problems in one of our custom functions we created. This is for the Visual Studio 2013 64bit generator. We have a function to create tests that accepts an 'INCLUDES' parameter, and we tend to use generator expressions to pass include directories from other libraries in the solution, i.e. something like this: add_test( TARGET TestName INCLUDES $ $ LIBRARIES AnotherLib YetAnotherLib SOURCES TestSource1.cpp TestSource2.cpp ) Inside the function definition we use cmake_parse_arguments to parse these arguments, i.e. something like this: function(add_test) cmake_parse_arguments( PARSED_ARGS "" "TARGET" "SOURCES;LIBRARIES;INCLUDES" ${ARGN} ) If I now inspect the value of ${PARSED_ARGS_INCLUDES} I see the result I at least expected, namely "$;$". This value is passed on to target_include_directories inside the function, like so: target_include_directories(${PARSED_ARGS_TARGET} PRIVATE ${PARSE_ARGS_INCLUDES} ) It is this line that starts producing unexplainable errors that look like this: CMake Error in ../CMakeLists.txt: Found relative path while evaluating include directories of "TestName": "PTARGET_PROPERTY:Lib1,INTERFACE_INCLUDE_DIRECTORIES>" The first letter, here 'P', can be many letters, it seems some random character appear here, including non-printable characters. What am I looking at here? Are we using some functionality that was removed or changed from CMake 3.5.2. From the release notes I don't see anything that could be related. Sincerely, Jakob -------------- next part -------------- An HTML attachment was scrubbed... URL: From Robert.Bielik at dirac.se Tue Apr 26 05:18:21 2016 From: Robert.Bielik at dirac.se (Robert Bielik) Date: Tue, 26 Apr 2016 09:18:21 +0000 Subject: [CMake] install target problem on Mac Message-ID: Using Cmake 3.0.1 I have a dynlib target: ADD_LIBRARY(myDynlib SHARED ${SOURCES}) and INSTALL(TARGETS myDynlib LIBRARY DESTINATION ${OUTPUT_PATH}/lib ) however, building the install target, no files end up in ${OUTPUT_PATH}/lib . Help? /R From Robert.Bielik at dirac.se Tue Apr 26 06:33:10 2016 From: Robert.Bielik at dirac.se (Robert Bielik) Date: Tue, 26 Apr 2016 10:33:10 +0000 Subject: [CMake] install target problem on Mac In-Reply-To: References: Message-ID: <87f80aecd5ae41dda60c73c3d310b3b9@hosted3-mb02.itm.host> Updated to CMake 3.5.2, and now the same CmakeLists.txt works fine. Oh well :) Rgrds /R -----Original Message----- From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Robert Bielik Sent: den 26 april 2016 11:18 To: cmake at cmake.org Subject: [CMake] install target problem on Mac Using Cmake 3.0.1 I have a dynlib target: ADD_LIBRARY(myDynlib SHARED ${SOURCES}) and INSTALL(TARGETS myDynlib LIBRARY DESTINATION ${OUTPUT_PATH}/lib ) however, building the install target, no files end up in ${OUTPUT_PATH}/lib . Help? /R -- 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 From tanstry at gmail.com Tue Apr 26 09:03:43 2016 From: tanstry at gmail.com (Trystan Louboutin) Date: Tue, 26 Apr 2016 15:03:43 +0200 Subject: [CMake] Separated Windows installers with CPack / NSIS Message-ID: Hi, I want to generate multiple Windows installers with CPack / NSIS (CMake v3.5.2). Each one will embed the same executable (same CMake project) but with different configurations and documents. I tried with separated components and played with many options like - CPACK_NSIS_MONOLITHIC_INSTALL - CPACK_NSIS_COMPONENT_INSTALL - CPACK_ARCHIVE_COMPONENT_INSTALL with no success, I always get a single .exe installer file... Is it possible with CPack / NSIS directly? -Trystan -------------- next part -------------- An HTML attachment was scrubbed... URL: From zcsd2012 at gmail.com Tue Apr 26 09:22:19 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Tue, 26 Apr 2016 06:22:19 -0700 (MST) Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: References: <1461632485342-7593346.post@n2.nabble.com> Message-ID: <1461676939174-7593361.post@n2.nabble.com> Hi, all, Thanks for your sincerely help, and i understand it clearly now. ( ^_^ ) Best regards, Chao J. Caleb Wherry wrote > (Shameless plug ahead) > > If you want to see a working example of what I said above, you can check > out my ExampleCMakeProject: > > https://github.com/calebwherry/example-cmake-project > > It is currently being built and tested on TravisCI (Linux + Mac [GGC5 and > Clang3.7]) and Appveyor (Windows [VS2015]) and provides a simple example > of > how to write/structure CMake for cross-platform C/C++ projects. You can > ignore the python wrapper if you want, it just makes working with the > CMake > exe and system builds easier (calculates core counts, creates directories > for build, nicer CLI options, etc) since I find the options to CMake to be > very... verbose. > > The POST_BUILD example is here: > > https://github.com/calebwherry/example-cmake-project/blob/master/src/app/test-app/CMakeLists.txt > > If you really are looking to get a one-off project working, Decker's > recommendation about PATH modification is easiest. It's just not something > I think is viable in the long run and doesn't work as an actual solution > to > the problem if you are trying to solve it for many projects. > > -Caleb > > On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang < > zcsd2012@ > > wrote: > >> Hi, >> >> I faced this problem when i try built a shared lib and linked it on >> windows. The structure of my project as below: >> -test_dir/ >> -sub_hello/ >> CMakeLists.txt >> hello.c >> -top/ >> main.c >> CMakeLists.txt >> CMakeLists.txt >> >> The content of each file: >> ?test_dir/CMakeLists.txt: >> PROJECT(TESTLIB) >> add_subdirectory(sub_hello sub_hello) >> add_subdirectory(top top) >> >> ?test_dir/sub_hello/CMakeLists.txt: >> message("message from sub_hello") >> add_library(hello_lib SHARED hello.c) >> >> ?test_dir/top/CMakeLists.txt: >> include_directories(../sub_hello) >> add_executable(main main.c) >> target_link_libraries(main hello_lib) >> >> ?test_dir/sub_hello/hello.c? >> #include > >> void HelloFunc() >> { >> printf("###hello###\n"); >> } >> >> ?test_dir/top/main.c: >> int main() >> { >> HelloFunc(); >> return 0; >> } >> >> After i cmake this project, generated .sln and .proj files, then i built >> it >> and i get an error in vs: >> >> Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" >> >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. >> Then i look thorough and found a solution: >> >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file >> test_dir/sub_hello/hello.c >> >> Then i built this solution again, this time it success, and hello_lib.lib >> and main.exe was generated. But when i try to run main.exe, an error >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder >> of >> main.exe, and it worked well. >> >> There are two questions i could not figure out: >> ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with >> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll >> directly, >> and use a .lib to record the .dll's entrance and location. >> ?How to solve the problem of main.exe can not find .dll file. >> >> Best regards, >> Chao Zhang >> >> >> >> >> >> -- >> View this message in context: >> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html >> Sent from the CMake mailing list archive at Nabble.com. >> -- >> >> 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 > > > > > -- > J. Caleb Wherry > *Scientific Software Engineer* > > <http://www.calebwherry.com> > http://www.calebwherry.com > +1 (615) 708-5651 > calebwherry@ > > -- > > 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 -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346p7593361.html Sent from the CMake mailing list archive at Nabble.com. From chuck.atkins at kitware.com Tue Apr 26 13:08:17 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Tue, 26 Apr 2016 13:08:17 -0400 Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: <1461676939174-7593361.post@n2.nabble.com> References: <1461632485342-7593346.post@n2.nabble.com> <1461676939174-7593361.post@n2.nabble.com> Message-ID: May others have mentioned the various different ways to address generating import libraries. One thing that will help with the "can't find .dll" issue is to change the default location that various components end up. With Windows shared libraries, you have both a runtime component (.dll) and a link time component (.lib). Setting the following at the top of your CMakeLists.txt: if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") endif() if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") endif() if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") endif() This is a common pattern to place near the beginning of a top-level CMakeLists.txt after the project(...) copmmand. What this does is make sure that all runtime components end up in the bin directory, including both .exe's and .dll's, and that all link-time components, including .so's and .a's in Linux and .lib's on Windows, end up in the the lib directory. This way when you run your executable on Windows, their necessary runtime components live next to them. It also consolidates all your build products into one place instead of leaving them scattered across the various sub-directories of the build folder. - Chuck On Tue, Apr 26, 2016 at 9:22 AM, Chaos Zhang wrote: > Hi, all, > > Thanks for your sincerely help, and i understand it clearly now. ( ^_^ ) > > Best regards, > Chao > > > J. Caleb Wherry wrote > > (Shameless plug ahead) > > > > If you want to see a working example of what I said above, you can check > > out my ExampleCMakeProject: > > > > https://github.com/calebwherry/example-cmake-project > > > > It is currently being built and tested on TravisCI (Linux + Mac [GGC5 and > > Clang3.7]) and Appveyor (Windows [VS2015]) and provides a simple example > > of > > how to write/structure CMake for cross-platform C/C++ projects. You can > > ignore the python wrapper if you want, it just makes working with the > > CMake > > exe and system builds easier (calculates core counts, creates directories > > for build, nicer CLI options, etc) since I find the options to CMake to > be > > very... verbose. > > > > The POST_BUILD example is here: > > > > > https://github.com/calebwherry/example-cmake-project/blob/master/src/app/test-app/CMakeLists.txt > > > > If you really are looking to get a one-off project working, Decker's > > recommendation about PATH modification is easiest. It's just not > something > > I think is viable in the long run and doesn't work as an actual solution > > to > > the problem if you are trying to solve it for many projects. > > > > -Caleb > > > > On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang < > > > zcsd2012@ > > > > wrote: > > > >> Hi, > >> > >> I faced this problem when i try built a shared lib and linked it on > >> windows. The structure of my project as below: > >> -test_dir/ > >> -sub_hello/ > >> CMakeLists.txt > >> hello.c > >> -top/ > >> main.c > >> CMakeLists.txt > >> CMakeLists.txt > >> > >> The content of each file: > >> ?test_dir/CMakeLists.txt: > >> PROJECT(TESTLIB) > >> add_subdirectory(sub_hello sub_hello) > >> add_subdirectory(top top) > >> > >> ?test_dir/sub_hello/CMakeLists.txt: > >> message("message from sub_hello") > >> add_library(hello_lib SHARED hello.c) > >> > >> ?test_dir/top/CMakeLists.txt: > >> include_directories(../sub_hello) > >> add_executable(main main.c) > >> target_link_libraries(main hello_lib) > >> > >> ?test_dir/sub_hello/hello.c? > >> #include > > > >> void HelloFunc() > >> { > >> printf("###hello###\n"); > >> } > >> > >> ?test_dir/top/main.c: > >> int main() > >> { > >> HelloFunc(); > >> return 0; > >> } > >> > >> After i cmake this project, generated .sln and .proj files, then i built > >> it > >> and i get an error in vs: > >> > >> Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" > >> > >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. > >> Then i look thorough and found a solution: > >> > >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file > >> test_dir/sub_hello/hello.c > >> > >> Then i built this solution again, this time it success, and > hello_lib.lib > >> and main.exe was generated. But when i try to run main.exe, an error > >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder > >> of > >> main.exe, and it worked well. > >> > >> There are two questions i could not figure out: > >> ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with > >> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll > >> directly, > >> and use a .lib to record the .dll's entrance and location. > >> ?How to solve the problem of main.exe can not find .dll file. > >> > >> Best regards, > >> Chao Zhang > >> > >> > >> > >> > >> > >> -- > >> View this message in context: > >> > http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html > >> Sent from the CMake mailing list archive at Nabble.com. > >> -- > >> > >> 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 > > > > > > > > > > -- > > J. Caleb Wherry > > *Scientific Software Engineer* > > > > <http://www.calebwherry.com> > > http://www.calebwherry.com > > +1 (615) 708-5651 > > > calebwherry@ > > > > > -- > > > > 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 > > > > > > -- > View this message in context: > http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346p7593361.html > Sent from the CMake mailing list archive at Nabble.com. > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ajneu1 at gmail.com Tue Apr 26 13:57:38 2016 From: ajneu1 at gmail.com (aj neu) Date: Tue, 26 Apr 2016 19:57:38 +0200 Subject: [CMake] project command not working, when used via macro (from an included file) Message-ID: Hi, when calling `project` ...as seen here ... https://github.com/ajneu/cmake_project_via_macro/blob/5972c7362e11fdbaa09d9defe8cca2dcea79e606/CMakeLists.txt#L33 everything is ok. BUT when calling `project` via a macro (that was included) ... as seen here ... https://github.com/ajneu/cmake_project_via_macro/blob/master/CMakeLists.txt#L33 the behaviour is not as expected. Why? (Details are here: https://github.com/ajneu/cmake_project_via_macro) Is this a bug? Thanks ajneu -------------- next part -------------- An HTML attachment was scrubbed... URL: From chuck.atkins at kitware.com Tue Apr 26 14:04:19 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Tue, 26 Apr 2016 14:04:19 -0400 Subject: [CMake] project command not working, when used via macro (from an included file) In-Reply-To: References: Message-ID: ajneu, The call to project(...) needs to be explicit. See https://cmake.org/cmake/help/v3.5/command/project.html: The top-level CMakeLists.txt file for a project must contain a literal, direct call to the project() command; loading one through the include() command is not sufficient. - Chuck On Tue, Apr 26, 2016 at 1:57 PM, aj neu wrote: > Hi, > > when calling `project` > ...as seen here > ... > https://github.com/ajneu/cmake_project_via_macro/blob/5972c7362e11fdbaa09d9defe8cca2dcea79e606/CMakeLists.txt#L33 > everything is ok. > > > BUT when calling `project` via a macro (that was included) > ... as seen here > ... > https://github.com/ajneu/cmake_project_via_macro/blob/master/CMakeLists.txt#L33 > the behaviour is not as expected. > > Why? > > (Details are here: https://github.com/ajneu/cmake_project_via_macro) > > > Is this a bug? > > Thanks > ajneu > > > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike.jackson at bluequartz.net Tue Apr 26 14:24:30 2016 From: mike.jackson at bluequartz.net (Michael Jackson) Date: Tue, 26 Apr 2016 14:24:30 -0400 Subject: [CMake] Install with full absolute path on OS X Message-ID: <571FB25E.9060906@bluequartz.net> I am building a library and installing onto the local system. After installation otool reports that the path is "@rpath/lib/libEMsoft.dylib" How can I have the installed path be the full absolute path to the library. For this use case @rpath is not going to work. I have tried https://cmake.org/Wiki/CMake_RPATH_handling and variations of that information but none of it seems to work. THanks -- Mike Jackson [mike.jackson at bluequartz.net] -------------- next part -------------- An HTML attachment was scrubbed... URL: From clinton at elemtech.com Tue Apr 26 14:57:51 2016 From: clinton at elemtech.com (clinton at elemtech.com) Date: Tue, 26 Apr 2016 12:57:51 -0600 (MDT) Subject: [CMake] Install with full absolute path on OS X In-Reply-To: <571FB25E.9060906@bluequartz.net> References: <571FB25E.9060906@bluequartz.net> Message-ID: <914718853.111830735.1461697071019.JavaMail.zimbra@elemtech.com> To set the install name to an absolute path, it would probably be something like set_property(TARGET EMsoft PROPERTY INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib) Clint ----- On Apr 26, 2016, at 12:24 PM, Michael Jackson wrote: > I am building a library and installing onto the local system. After installation > otool reports that the path is "@rpath/lib/libEMsoft.dylib" > How can I have the installed path be the full absolute path to the library. For > this use case @rpath is not going to work. > I have tried https://cmake.org/Wiki/CMake_RPATH_handling and variations of that > information but none of it seems to work. > THanks > -- > Mike Jackson [ mike.jackson at bluequartz.net ] > -- > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zcsd2012 at gmail.com Tue Apr 26 20:13:15 2016 From: zcsd2012 at gmail.com (Chaos Zhang) Date: Tue, 26 Apr 2016 17:13:15 -0700 (MST) Subject: [CMake] How to link shared lib on windows (visual studio 2014). In-Reply-To: References: <1461632485342-7593346.post@n2.nabble.com> <1461676939174-7593361.post@n2.nabble.com> Message-ID: <1461715995134-7593367.post@n2.nabble.com> Thanks again Mr. Atkins. Chuck Atkins wrote > May others have mentioned the various different ways to address generating > import libraries. One thing that will help with the "can't find .dll" > issue is to change the default location that various components end up. > With Windows shared libraries, you have both a runtime component (.dll) > and > a link time component (.lib). Setting the following at the top of your > CMakeLists.txt: > > if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) > set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") > endif() > if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) > set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") > endif() > if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) > set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") > endif() > > This is a common pattern to place near the beginning of a top-level > CMakeLists.txt after the project(...) copmmand. What this does is make > sure that all runtime components end up in the bin directory, including > both .exe's and .dll's, and that all link-time components, including .so's > and .a's in Linux and .lib's on Windows, end up in the the lib directory. > This way when you run your executable on Windows, their necessary runtime > components live next to them. It also consolidates all your build > products > into one place instead of leaving them scattered across the various > sub-directories of the build folder. > > - Chuck > > On Tue, Apr 26, 2016 at 9:22 AM, Chaos Zhang < > zcsd2012@ > > wrote: > >> Hi, all, >> >> Thanks for your sincerely help, and i understand it clearly now. ( ^_^ ) >> >> Best regards, >> Chao >> >> >> J. Caleb Wherry wrote >> > (Shameless plug ahead) >> > >> > If you want to see a working example of what I said above, you can >> check >> > out my ExampleCMakeProject: >> > >> > https://github.com/calebwherry/example-cmake-project >> > >> > It is currently being built and tested on TravisCI (Linux + Mac [GGC5 >> and >> > Clang3.7]) and Appveyor (Windows [VS2015]) and provides a simple >> example >> > of >> > how to write/structure CMake for cross-platform C/C++ projects. You can >> > ignore the python wrapper if you want, it just makes working with the >> > CMake >> > exe and system builds easier (calculates core counts, creates >> directories >> > for build, nicer CLI options, etc) since I find the options to CMake to >> be >> > very... verbose. >> > >> > The POST_BUILD example is here: >> > >> > >> https://github.com/calebwherry/example-cmake-project/blob/master/src/app/test-app/CMakeLists.txt >> > >> > If you really are looking to get a one-off project working, Decker's >> > recommendation about PATH modification is easiest. It's just not >> something >> > I think is viable in the long run and doesn't work as an actual >> solution >> > to >> > the problem if you are trying to solve it for many projects. >> > >> > -Caleb >> > >> > On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang < >> >> > zcsd2012@ >> >> > > wrote: >> > >> >> Hi, >> >> >> >> I faced this problem when i try built a shared lib and linked it on >> >> windows. The structure of my project as below: >> >> -test_dir/ >> >> -sub_hello/ >> >> CMakeLists.txt >> >> hello.c >> >> -top/ >> >> main.c >> >> CMakeLists.txt >> >> CMakeLists.txt >> >> >> >> The content of each file: >> >> ?test_dir/CMakeLists.txt: >> >> PROJECT(TESTLIB) >> >> add_subdirectory(sub_hello sub_hello) >> >> add_subdirectory(top top) >> >> >> >> ?test_dir/sub_hello/CMakeLists.txt: >> >> message("message from sub_hello") >> >> add_library(hello_lib SHARED hello.c) >> >> >> >> ?test_dir/top/CMakeLists.txt: >> >> include_directories(../sub_hello) >> >> add_executable(main main.c) >> >> target_link_libraries(main hello_lib) >> >> >> >> ?test_dir/sub_hello/hello.c? >> >> #include >> > > >> >> void HelloFunc() >> >> { >> >> printf("###hello###\n"); >> >> } >> >> >> >> ?test_dir/top/main.c: >> >> int main() >> >> { >> >> HelloFunc(); >> >> return 0; >> >> } >> >> >> >> After i cmake this project, generated .sln and .proj files, then i >> built >> >> it >> >> and i get an error in vs: >> >> >> >> Error LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib" >> >> >> >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed. >> >> Then i look thorough and found a solution: >> >> >> >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file >> >> test_dir/sub_hello/hello.c >> >> >> >> Then i built this solution again, this time it success, and >> hello_lib.lib >> >> and main.exe was generated. But when i try to run main.exe, an error >> >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the >> folder >> >> of >> >> main.exe, and it worked well. >> >> >> >> There are two questions i could not figure out: >> >> ?Is this "..\sub_hello\Debug\hello_lib.lib" associates with >> >> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll >> >> directly, >> >> and use a .lib to record the .dll's entrance and location. >> >> ?How to solve the problem of main.exe can not find .dll file. >> >> >> >> Best regards, >> >> Chao Zhang >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> View this message in context: >> >> >> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html >> >> Sent from the CMake mailing list archive at Nabble.com. >> >> -- >> >> >> >> 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 >> > >> > >> > >> > >> > -- >> > J. Caleb Wherry >> > *Scientific Software Engineer* >> > >> > <http://www.calebwherry.com> >> > http://www.calebwherry.com >> > +1 (615) 708-5651 >> >> > calebwherry@ >> >> > >> > -- >> > >> > 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 >> >> >> >> >> >> -- >> View this message in context: >> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346p7593361.html >> Sent from the CMake mailing list archive at Nabble.com. >> -- >> >> 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 -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346p7593367.html Sent from the CMake mailing list archive at Nabble.com. From dushara at successful.com.au Wed Apr 27 03:02:49 2016 From: dushara at successful.com.au (Dushara Jayasinghe) Date: Wed, 27 Apr 2016 17:02:49 +1000 Subject: [CMake] install/fast Makerule failing in buildroot Message-ID: <57206419.4000205@successful.com.au> Hi all, I'm trying to include a package to buildroot (2016.02) with cmake as the build generator however, I've hit a bit of a snag. This particular version of buildroot is using CMake version 3.4.3. The package builds as expected, however during the install step, the following error is generated: make[2]: *** No rule to make target `install/fast'. Stop. I had a look at the generated Makefile and found it lacks any install rules (there are preinstall rules only). The toolchain I'm using is a cross compiler targeting an arm platform. Buildroot compiles the tool chain as well as CMake as part of the build process. Is anyone able to point me in the area of CMake sources that I need to look at to fix this particular issue? Thanks, DJ From marc.chevrier at sap.com Wed Apr 27 03:14:19 2016 From: marc.chevrier at sap.com (CHEVRIER, Marc) Date: Wed, 27 Apr 2016 07:14:19 +0000 Subject: [CMake] project command not working, when used via macro (from an included file) In-Reply-To: References: Message-ID: <154AFDE2-B6CE-47B9-9C1F-CE3FAC35E8B7@sap.com> May be using keyword NO_POLICY_SCOPE in include command will solve your problem? From: CMake > on behalf of Chuck Atkins > Date: Tuesday 26 April 2016 at 20:04 To: aj neu > Cc: "cmake at cmake.org" > Subject: Re: [CMake] project command not working, when used via macro (from an included file) ajneu, The call to project(...) needs to be explicit. See https://cmake.org/cmake/help/v3.5/command/project.html: The top-level CMakeLists.txt file for a project must contain a literal, direct call to the project() command; loading one through the include() command is not sufficient. - Chuck On Tue, Apr 26, 2016 at 1:57 PM, aj neu > wrote: Hi, when calling `project` ...as seen here ... https://github.com/ajneu/cmake_project_via_macro/blob/5972c7362e11fdbaa09d9defe8cca2dcea79e606/CMakeLists.txt#L33 everything is ok. BUT when calling `project` via a macro (that was included) ... as seen here ... https://github.com/ajneu/cmake_project_via_macro/blob/master/CMakeLists.txt#L33 the behaviour is not as expected. Why? (Details are here: https://github.com/ajneu/cmake_project_via_macro) Is this a bug? Thanks ajneu -- 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhongle at proplussolution.com Wed Apr 27 03:35:44 2016 From: zhongle at proplussolution.com (vakano) Date: Wed, 27 Apr 2016 00:35:44 -0700 (MST) Subject: [CMake] How to set link option In-Reply-To: <8760v4u5dz.fsf@sobel.cipherstone.com> References: <1461244703147-7593307.post@n2.nabble.com> <8760v4u5dz.fsf@sobel.cipherstone.com> Message-ID: <1461742544376-7593370.post@n2.nabble.com> I think the variable CMAKE_EXE_LINKER_FLAGS or LINK_FLAGS may work, but since my project have some other issues, I have not reached to link steps. Thanks, Le Magnus Therning wrote > vakano < > zhongle@ > > writes: > >> Hi, >> >> I have some link option as below: >> >> -Wl, -rpath, ${PROJECT_TOP}/dist ../proj_a/lib_a.a -lb -Wl, >> --whole-archive >> ../proj_c/lib_c.a > > What have you tried? > > /M > > -- > Magnus Therning OpenPGP: 0x927912051716CE39 > email: > magnus@ > jabber: > magnus@ > twitter: magthe http://therning.org/magnus > > McBryan's Law: You can't make it better until you make it work. > > -- > > 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 > > signature.asc (815 bytes) > <http://cmake.3232098.n2.nabble.com/attachment/7593356/0/signature.asc> -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-set-link-option-tp7593307p7593370.html Sent from the CMake mailing list archive at Nabble.com. From mike.jackson at bluequartz.net Wed Apr 27 09:53:24 2016 From: mike.jackson at bluequartz.net (Michael Jackson) Date: Wed, 27 Apr 2016 09:53:24 -0400 Subject: [CMake] Install with full absolute path on OS X In-Reply-To: <914718853.111830735.1461697071019.JavaMail.zimbra@elemtech.com> References: <571FB25E.9060906@bluequartz.net> <914718853.111830735.1461697071019.JavaMail.zimbra@elemtech.com> Message-ID: <5720C454.9030803@bluequartz.net> Thanks. That was the solution. -- Mike Jackson [mike.jackson at bluequartz.net] > clinton at elemtech.com > April 26, 2016 at 2:57 PM > > To set the install name to an absolute path, it would probably be > something like > set_property(TARGET EMsoft PROPERTY INSTALL_NAME_DIR > ${CMAKE_INSTALL_PREFIX}/lib) > > Clint > > ----- On Apr 26, 2016, at 12:24 PM, Michael Jackson > wrote: > Michael Jackson > April 26, 2016 at 2:24 PM > I am building a library and installing onto the local system. After > installation otool reports that the path is "@rpath/lib/libEMsoft.dylib" > > How can I have the installed path be the full absolute path to the > library. For this use case @rpath is not going to work. > > I have tried https://cmake.org/Wiki/CMake_RPATH_handling and > variations of that information but none of it seems to work. > > THanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From ajneu1 at gmail.com Wed Apr 27 10:09:08 2016 From: ajneu1 at gmail.com (aj neu) Date: Wed, 27 Apr 2016 16:09:08 +0200 Subject: [CMake] project command not working, when used via macro (from an included file) In-Reply-To: References: Message-ID: Ok thanks. But it is unfortunate, since it means that really great macros, such as project_guarded (see http://stackoverflow.com/a/33100078) cannot be used everywhere, as a substitute for project. On Tue, Apr 26, 2016 at 8:04 PM, Chuck Atkins wrote: > ajneu, > > The call to project(...) needs to be explicit. See > https://cmake.org/cmake/help/v3.5/command/project.html: > > The top-level CMakeLists.txt file for a project must contain a literal, > direct call to the project() > > command; loading one through the include() > > command is not sufficient. > > - Chuck > > On Tue, Apr 26, 2016 at 1:57 PM, aj neu wrote: > >> Hi, >> >> when calling `project` >> ...as seen here >> ... >> https://github.com/ajneu/cmake_project_via_macro/blob/5972c7362e11fdbaa09d9defe8cca2dcea79e606/CMakeLists.txt#L33 >> everything is ok. >> >> >> BUT when calling `project` via a macro (that was included) >> ... as seen here >> ... >> https://github.com/ajneu/cmake_project_via_macro/blob/master/CMakeLists.txt#L33 >> the behaviour is not as expected. >> >> Why? >> >> (Details are here: https://github.com/ajneu/cmake_project_via_macro) >> >> >> Is this a bug? >> >> Thanks >> ajneu >> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From chuck.atkins at kitware.com Wed Apr 27 11:05:45 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Wed, 27 Apr 2016 11:05:45 -0400 Subject: [CMake] project command not working, when used via macro (from an included file) In-Reply-To: References: Message-ID: Perhaps I spoke to hastily. It seems the unsupported configuration is if project(...) is actually called from an include file, which makes sense given various scoping issues. Give that, what you have should work fine. What doesn't work as expected? It seems to work just fine when I try it from a macro defined in an include file. Also, what version of CMake are you using so I can try to reproduce your configuration more closely? - Chuck On Wed, Apr 27, 2016 at 10:09 AM, aj neu wrote: > Ok thanks. > But it is unfortunate, since it means that really great macros, such as > project_guarded > (see http://stackoverflow.com/a/33100078) > cannot be used everywhere, as a substitute for project. > > > > On Tue, Apr 26, 2016 at 8:04 PM, Chuck Atkins > wrote: > >> ajneu, >> >> The call to project(...) needs to be explicit. See >> https://cmake.org/cmake/help/v3.5/command/project.html: >> >> The top-level CMakeLists.txt file for a project must contain a literal, >> direct call to the project() >> >> command; loading one through the include() >> >> command is not sufficient. >> >> - Chuck >> >> On Tue, Apr 26, 2016 at 1:57 PM, aj neu wrote: >> >>> Hi, >>> >>> when calling `project` >>> ...as seen here >>> ... >>> https://github.com/ajneu/cmake_project_via_macro/blob/5972c7362e11fdbaa09d9defe8cca2dcea79e606/CMakeLists.txt#L33 >>> everything is ok. >>> >>> >>> BUT when calling `project` via a macro (that was included) >>> ... as seen here >>> ... >>> https://github.com/ajneu/cmake_project_via_macro/blob/master/CMakeLists.txt#L33 >>> the behaviour is not as expected. >>> >>> Why? >>> >>> (Details are here: https://github.com/ajneu/cmake_project_via_macro) >>> >>> >>> Is this a bug? >>> >>> Thanks >>> ajneu >>> >>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mkeeler at tenable.com Wed Apr 27 11:57:14 2016 From: mkeeler at tenable.com (Matthew Keeler) Date: Wed, 27 Apr 2016 11:57:14 -0400 Subject: [CMake] LINK_FLAGS directory property Message-ID: Is there an equivalent directory property for the target level LINK_FLAGS property. I can?t see anything according to the documentation but was hoping there was an oversight and something actually existed. What I am trying to do is pass extra flags to the linker for every target in my project and I didn?t want to have to set it per target. I tried using the link_libraries command but the flags I am adding are msvc specific and start with ?/? and cmake seems to be turning these into ?\? when its passed to the linker. Then the linker thinks its trying to link in another file and everything blows up. Also a secondary question is what does the INTERPROCEDURAL_OPTIMIZATIONS property at the directory level do. I assume on Windows it passes /GL to the compiler but will this also add /LCTG to the linker flags and prevent incremental linking. If I turn this property on will it also do it for debug configurations or just optimized configurations? --? Matt Keeler -------------- next part -------------- An HTML attachment was scrubbed... URL: From daum at chimaera.de Thu Apr 28 07:37:11 2016 From: daum at chimaera.de (Volker Daum) Date: Thu, 28 Apr 2016 13:37:11 +0200 Subject: [CMake] CTest/CDash + DynamicAnalysis (Valgrind MemCheck) Message-ID: <699aa234-f6f8-0ae5-0494-83c8ed6a1602@chimaera.de> Hi CMake/CTest users and Developers. I actually have a question about CTest and hope this is the right list to ask it. I am confused by CTest behavior when doing dynamic analysis with valgrind (MemCheck). The issue I am having is that CTest does not output test results in the generated XML if the test passes and no issues are reported by valgrind. Therefore, for a completely successful test run the dynamic analysis displayed in my CDash dashboard is empty, as if no test at all had been run. I might be doing something wrong, but checking the CTest source (cmTestMemCheckHandler.cxx) suggests that test output is deliberately suppressed in case the test result is COMPLETED. Am I doing anything wrong in using CTest here or is this actually intended behavior? And if it is intended behavior what is the rationale for it? Best Regards, Volker -- ------------------------------------------------------------------ Dr.-Ing. Volker Daum Chimaera GmbH Am Weichselgarten 7, 91058 Erlangen, Germany Phone: +49 (0)9131 691 385 Fax: +49 (0)9131 691 386 E-Mail: daum at chimaera.de WWW: www.chimaera.de Registergericht: Amtsgericht, 90762 F?rth (HRB 15128) Geschaeftsfuehrer: Volker Daum, Dieter Hahn, Marcus Pruemmer USt-IdNr (VAT ID): De253510665 ------------------------------------------------------------------ Confidentiality Notice The information transmitted in this e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged information. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please contact the sender and delete the e-mail and any attached material immediately. Thank you. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3701 bytes Desc: S/MIME Cryptographic Signature URL: From iraytrace at gmail.com Thu Apr 28 11:19:05 2016 From: iraytrace at gmail.com (Lee Butler) Date: Thu, 28 Apr 2016 11:19:05 -0400 Subject: [CMake] Is there a better way to retrieve content from a remote zip file? Message-ID: <572229E9.7040606@gmail.com> I am looking for a better way to do something than having a sequence of "if (NOT EXISTS)" statements. My package being built depends on some external libraries and headers, that are available in a zip file on an external website. So for example: zlib.h,zlib.dll and zlib.lib are (along with other stuff) in 3rdParty.zip available from a remote URL. I don't want to build these things, I want to fetch the zip file, unpack it and copy the relevant portions into place only as needed. At the moment I have the code below, which feels "unclean" on so many levels: if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/include/zlib.h") if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64") if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z") MESSAGE(STATUS "Downloading 3rdParty") file(DOWNLOAD http://download.osgvisual.org/3rdParty_VS2013_v120_x86_x64_V9_small.7z "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z" SHOW_PROGRESS) endif() message(STATUS "expanding 3rdParty Archive") execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z" ) endif() foreach(dir bin data include lib ssl) file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64/x64/${dir}" "${CMAKE_INSTALL_PREFIX}/${dir}") endforeach(dir) file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64") endif() This has the property of fetching the 7z file, extracting the contents and leaving the 7z file around for later rebuilds. I hope there is a cleaner way of saying the same thing. BTW, I would be just as happy putting "products" from the zip file in the current build destinations instead of the install destinations. From chuck.atkins at kitware.com Thu Apr 28 11:58:12 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Thu, 28 Apr 2016 11:58:12 -0400 Subject: [CMake] Is there a better way to retrieve content from a remote zip file? In-Reply-To: <572229E9.7040606@gmail.com> References: <572229E9.7040606@gmail.com> Message-ID: This looks well suited to ExternalProject. Just give it an empty configure and build steps and then have the install step perform the copy: include(ExternalProject) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(3rdParty_SUBDIR x64) else() set(3rdParty_SUBDIR x86) endif() ExternalProject_Add( 3rdParty URL http://download.osgvisual.org/3rdParty_VS2013_v120_x86_x64_V9_small.7z URL_MD5 c9294a16b39783cba8c4c55df182b24b BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${3rdParty_SUBDIR}/ ${CMAKE_INSTALL_PREFIX} ) This created a "3rdParty" target that should do everything you need and only if necessary. - Chuck On Thu, Apr 28, 2016 at 11:19 AM, Lee Butler wrote: > I am looking for a better way to do something than having a sequence of > "if (NOT EXISTS)" statements. My package being built depends on some > external libraries and headers, that are available in a zip file on an > external website. So for example: zlib.h,zlib.dll and zlib.lib are (along > with other stuff) in 3rdParty.zip available from a remote URL. I don't > want to build these things, I want to fetch the zip file, unpack it and > copy the relevant portions into place only as needed. > > At the moment I have the code below, which feels "unclean" on so many > levels: > > if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/include/zlib.h") > if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64") > if (NOT EXISTS > "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z") > MESSAGE(STATUS "Downloading 3rdParty") > file(DOWNLOAD > http://download.osgvisual.org/3rdParty_VS2013_v120_x86_x64_V9_small.7z > "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z" > SHOW_PROGRESS) > endif() > > message(STATUS "expanding 3rdParty Archive") > execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf > "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z" ) > endif() > foreach(dir bin data include lib ssl) > file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64/x64/${dir}" > "${CMAKE_INSTALL_PREFIX}/${dir}") > endforeach(dir) > file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64") > endif() > > This has the property of fetching the 7z file, extracting the contents and > leaving the 7z file around for later rebuilds. I hope there is a cleaner > way of saying the same thing. BTW, I would be just as happy putting > "products" from the zip file in the current build destinations instead of > the install destinations. > -- > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From burlen.loring at gmail.com Thu Apr 28 14:21:55 2016 From: burlen.loring at gmail.com (Burlen Loring) Date: Thu, 28 Apr 2016 11:21:55 -0700 Subject: [CMake] default release build flags Message-ID: <572254C3.1060308@gmail.com> Hi Guys, I'd like to discuss changing the defaults of CMAKE_C/CXX_FLAGS_RELEASE on gcc, and potentially gcc like compilers such as clang and intel. Currently the default is "-O3 -DNDEBUG". I would like to discuss changing this to "-O3 -march=native -mtune=native -DNDEBUG". This change will enable numerous optimizations and produce faster code targeted for the cpu in use during the compilation. The majority of people want cpu specific optimization enabled when compiling code for use on their system. however many folks (specifically users of scientific codes who are often not computer scientists) don't realize requirement of passing march and mtune flags to enable cpu specific instruction sets. Of course there are a small number of developers making binaries for distribution who do not want to use cpu specific instructions, but the number of developers make binaries for distribution is small compared to folks who just need to compile code for their own use, and the folks making binaries are well aware of the issues and can be expected to know to disable such features. on my system here is the difference -03: $gcc -O3 -Q --help=target | grep enabled -m64 [enabled] -m80387 [enabled] -m96bit-long-double [enabled] -malign-stringops [enabled] -mfancy-math-387 [enabled] -mfentry [enabled] -mfp-ret-in-387 [enabled] -mglibc [enabled] -mhard-float [enabled] -mieee-fp [enabled] -mlong-double-80 [enabled] -mno-sse4 [enabled] -mpush-args [enabled] -mred-zone [enabled] -mstackrealign [enabled] -mtls-direct-seg-refs [enabled] -O3 -march=native -mtune=native $gcc -O3 -march=native -mtune=native -Q --help=target | grep enabled -m64 [enabled] -m80387 [enabled] -m96bit-long-double [enabled] -maes [enabled] -malign-stringops [enabled] -mavx [enabled] -mcx16 [enabled] -mf16c [enabled] -mfancy-math-387 [enabled] -mfentry [enabled] -mfp-ret-in-387 [enabled] -mfsgsbase [enabled] -mfxsr [enabled] -mglibc [enabled] -mhard-float [enabled] -mieee-fp [enabled] -mlong-double-80 [enabled] -mmmx [enabled] -mpclmul [enabled] -mpopcnt [enabled] -mpush-args [enabled] -mrdrnd [enabled] -mred-zone [enabled] -msahf [enabled] -msse [enabled] -msse2 [enabled] -msse3 [enabled] -msse4 [enabled] -msse4.1 [enabled] -msse4.2 [enabled] -mssse3 [enabled] -mstackrealign [enabled] -mtls-direct-seg-refs [enabled] -mxsave [enabled] -mxsaveopt [enabled] notice specifically the lack of sse and avx in -O3! these instruction sets play a major role in providing computational performance in modern cpus, and that's why I think they should be enable by default in cmake Release builds. clang and intel also support these flags, although there may be better alternatives. What do you think? Burlen -------------- next part -------------- An HTML attachment was scrubbed... URL: From snake.scaly at gmail.com Thu Apr 28 16:31:36 2016 From: snake.scaly at gmail.com (SnakE) Date: Thu, 28 Apr 2016 23:31:36 +0300 Subject: [CMake] ExternalProject_Add + imported targets: no rule to make yourlibrary.so Message-ID: Hello, I think I've found a bug in the ninja generator. I wonder if it's fixed already in a more recent cmake version. I'm using cmake 3.3.1. My project uses ExternalProject_Add() to pull some pre-built binaries from an internal repository in some configurations. In other configurations however that same dependency may be picked from the system, and yet in other configurations it is built from sources. So I want to unify the usage by only requiring the user code to do target_link_libraries(). I'm trying to utilize imported targets to achieve that. But I get errors immediately after I run the build before any download can happen. Here's a very simple CMakeLists.txt which allows to reproduce this on Linux. The foo_file target imitates downloading. You'll need to provide some trivial main.c, like "main() { return 0; }". If generated with the Makefile generator the build starts and then fails with an expected error: foo.so is indeed not a proper shared object. But if I generate for Ninja the build fails immediately with the error: "ninja: error: 'foo.so', needed by 'bar', missing and no known rule to make it" ------8<----CMakeLists.txt---------------------- cmake_minimum_required(VERSION 3.2) add_custom_target(foo_file COMMAND ${CMAKE_COMMAND} -E touch foo.so) add_library(foo SHARED IMPORTED) add_dependencies(foo foo_file) set_target_properties(foo PROPERTIES IMPORTED_LOCATION foo.so) add_executable(bar main.c) target_link_libraries(bar foo) ------8<---------------------------------------------- Should I file a bug report, or just switch to a newer CMake version? Thanks, SnakE -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig.scott at crascit.com Thu Apr 28 16:58:20 2016 From: craig.scott at crascit.com (Craig Scott) Date: Fri, 29 Apr 2016 06:58:20 +1000 Subject: [CMake] Is there a better way to retrieve content from a remote zip file? In-Reply-To: References: <572229E9.7040606@gmail.com> Message-ID: You may find the technique described at the following link useful (also based on ExternalProject, but slightly different take on how it's used): https://crascit.com/2015/07/25/cmake-gtest/ On Fri, Apr 29, 2016 at 1:58 AM, Chuck Atkins wrote: > This looks well suited to ExternalProject. Just give it an empty > configure and build steps and then have the install step perform the copy: > > include(ExternalProject) > > if(CMAKE_SIZEOF_VOID_P EQUAL 8) > set(3rdParty_SUBDIR x64) > else() > set(3rdParty_SUBDIR x86) > endif() > > ExternalProject_Add( 3rdParty > URL > http://download.osgvisual.org/3rdParty_VS2013_v120_x86_x64_V9_small.7z > URL_MD5 c9294a16b39783cba8c4c55df182b24b > BUILD_IN_SOURCE 1 > CONFIGURE_COMMAND "" > BUILD_COMMAND "" > INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${3rdParty_SUBDIR}/ > ${CMAKE_INSTALL_PREFIX} > ) > > This created a "3rdParty" target that should do everything you need and > only if necessary. > > - Chuck > > On Thu, Apr 28, 2016 at 11:19 AM, Lee Butler wrote: > >> I am looking for a better way to do something than having a sequence of >> "if (NOT EXISTS)" statements. My package being built depends on some >> external libraries and headers, that are available in a zip file on an >> external website. So for example: zlib.h,zlib.dll and zlib.lib are (along >> with other stuff) in 3rdParty.zip available from a remote URL. I don't >> want to build these things, I want to fetch the zip file, unpack it and >> copy the relevant portions into place only as needed. >> >> At the moment I have the code below, which feels "unclean" on so many >> levels: >> >> if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/include/zlib.h") >> if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64") >> if (NOT EXISTS >> "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z") >> MESSAGE(STATUS "Downloading 3rdParty") >> file(DOWNLOAD >> http://download.osgvisual.org/3rdParty_VS2013_v120_x86_x64_V9_small.7z >> "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z" >> SHOW_PROGRESS) >> endif() >> >> message(STATUS "expanding 3rdParty Archive") >> execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf >> "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_VS2013_v120_x86_x64_V9_small.7z" ) >> endif() >> foreach(dir bin data include lib ssl) >> file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64/x64/${dir}" >> "${CMAKE_INSTALL_PREFIX}/${dir}") >> endforeach(dir) >> file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/3rdParty_x86_x64") >> endif() >> >> This has the property of fetching the 7z file, extracting the contents >> and leaving the 7z file around for later rebuilds. I hope there is a >> cleaner way of saying the same thing. BTW, I would be just as happy >> putting "products" from the zip file in the current build destinations >> instead of the install destinations. >> -- >> >> 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 > -- Craig Scott Melbourne, Australia http://crascit.com -------------- next part -------------- An HTML attachment was scrubbed... URL: