Re: [CMake] target_sources and multiple subdirs
On Thu, Jun 21, 2018 at 2:47 AM, Michael Jackson < mike.jack...@bluequartz.net> wrote: > I have a project where we have a bunch of plugins that are compiled. We > are currently wrapping with Pybind11 to access those libraries from Python. > The issue on windows is that we get a multiple DLL load error and our > thought was to create 1 enormous python module library (Not sure if this is > the right idea or not….) > > > > So my question has to do with how to add files to a target that might > initially get created about 3 subdirs down from the top level > CMakeLists.txt file but each time cmake runs through a CMake file that > would configure a plugin can we just keep adding files to the python module > target through the use of target_sources() command. Not sure how that works > or if that idea would work. > > > > Thoughts or pointers would be very much welcome. > > > You should be able to use target_sources() to do that, although I'd recommend you create the target higher up rather than burying it deeper down in the subdirs. It would seem more logical to create the target at the point above where all the subdirs that add sources are. Maybe have a read of the following article for a more detailed discussion of using target_sources() in this way: https://crascit.com/2016/01/31/enhanced-source-file-handling-with-target_sources/ -- Craig Scott Melbourne, Australia https://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: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] [cmake-developers] Performance profiling for CMake scripts?
I've used the following a few times recently to get a sense of hotspots: https://gist.github.com/ihnorton/05f1dea38e596e75ba106855d490e66a On Wed, Jun 20, 2018 at 10:17 AM Robert Dailey wrote: > I set my minimum required version to 3.6, which should enable those > policies by default (if they're truly in 3.1 as you indicated). > > My CMake scripts do a lot of work to build a "tree" of properties > connecting targets, so that I can recurse the targets my system > generates to process things. CMake does not natively offer the ability > to recurse targets created AFAIK. I suspect a lot of this logic is > what is causing the slow down, but at this point I have no tooling to > help me prove that. > > I have included the developer list, maybe the CMake developers have > some insight for me as this doesn't seem to be a common user issue > from what I can tell. > > On Wed, Jun 20, 2018 at 7:39 AM, Robert Maynard > wrote: > > I am not aware of any built in functionality that can generate > > performance numbers for a project. > > > > Have you made sure that the performance/parsing policies are set to > > NEW or your cmake_minimum_required is sufficiently high, those can > > have a significant improvement on configuration time. > > > > Polices ( both in CMake 3.1 ) > > - CMP0054 'if parsing' > > - CMP0053 'simplified variable reference and escape parsing' > > > > On Tue, Jun 19, 2018 at 2:12 PM Robert Dailey > wrote: > >> > >> So I noticed over the years my CMake scripts take longer and longer to > >> configure/generate. Is there a mechanism to tell which parts of my > >> CMake scripts are slowest? I'd like to know how to optimize my CMake > >> scripts to reduce the time it takes to generate projects. > >> -- > >> > >> 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: > >> https://cmake.org/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: > https://cmake.org/mailman/listinfo/cmake-developers > -- 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: https://cmake.org/mailman/listinfo/cmake
[CMake] target_sources and multiple subdirs
I have a project where we have a bunch of plugins that are compiled. We are currently wrapping with Pybind11 to access those libraries from Python. The issue on windows is that we get a multiple DLL load error and our thought was to create 1 enormous python module library (Not sure if this is the right idea or not….) So my question has to do with how to add files to a target that might initially get created about 3 subdirs down from the top level CMakeLists.txt file but each time cmake runs through a CMake file that would configure a plugin can we just keep adding files to the python module target through the use of target_sources() command. Not sure how that works or if that idea would work. Thoughts or pointers would be very much welcome. -- Michael Jackson | Owner, President BlueQuartz Software [e] mike.jack...@bluequartz.net [w] www.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: https://cmake.org/mailman/listinfo/cmake
[CMake] Dos Line endings on response files when cross compiling.
On our project we do development on windows but build for QNX. We use the Unix Makefile generator. My team added several new source files to a project resulting in cmake generating an objects1.rsp file. When building after this, we would get an error from the linker, it always failed to find the last object file in the list despite it very clearly being in the binary directory. I eventually traced it down to dos line ending in the objects1.rsp file. It was looking for a ctrl+M character on the end of the file name. After running textto on the file, the project built as expected. After a little playing around with this we determined that 3.7.2 works fine, but 3.9, 3.10 and 3.11.3 all have this issue. Is this a defect in cmake, or is there configuration I am missing in the newer versions? To work around this, is there a way to disable the use of response files, or do I have to write a script that executes post configure to run textto on the files? Any help would be appreciated, Thanks! Joe Gebhard The information contained in or attached to this message is the confidential and proprietary information of Knorr-Bremse AG ("Knorr") and its wholly owned subsidiaries, New York Air Brake, LLC, Anchor Brake Shoe Company LLC, and Knorr Brake Ltd., and may contain the intellectual property of Knorr including, without limitation, trade secrets and copyrighted works. The information shall not be reproduced, disclosed to a third party, or used for any purposes other than those expressly permitted by Knorr. Your receipt and use of the information constitutes your acceptance of the confidential nature of the information and your obligation to protect the information subject to or in addition to any implied obligations or express agreements regarding confidential information between you or your employer and Knorr. If you received this communication in error, please notify the sender immediately and destroy all copies including any attachments. -- 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: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] Performance profiling for CMake scripts?
I set my minimum required version to 3.6, which should enable those policies by default (if they're truly in 3.1 as you indicated). My CMake scripts do a lot of work to build a "tree" of properties connecting targets, so that I can recurse the targets my system generates to process things. CMake does not natively offer the ability to recurse targets created AFAIK. I suspect a lot of this logic is what is causing the slow down, but at this point I have no tooling to help me prove that. I have included the developer list, maybe the CMake developers have some insight for me as this doesn't seem to be a common user issue from what I can tell. On Wed, Jun 20, 2018 at 7:39 AM, Robert Maynard wrote: > I am not aware of any built in functionality that can generate > performance numbers for a project. > > Have you made sure that the performance/parsing policies are set to > NEW or your cmake_minimum_required is sufficiently high, those can > have a significant improvement on configuration time. > > Polices ( both in CMake 3.1 ) > - CMP0054 'if parsing' > - CMP0053 'simplified variable reference and escape parsing' > > On Tue, Jun 19, 2018 at 2:12 PM Robert Dailey > wrote: >> >> So I noticed over the years my CMake scripts take longer and longer to >> configure/generate. Is there a mechanism to tell which parts of my >> CMake scripts are slowest? I'd like to know how to optimize my CMake >> scripts to reduce the time it takes to generate projects. >> -- >> >> 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: >> https://cmake.org/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: https://cmake.org/mailman/listinfo/cmake
[CMake] FindBoost with MSVC and LLVM Toolset
Hello! I got a problem while trying to use CMake 3.11.3 to configure a project that uses Boost.Exception library and LLVM-vs2014 toolset with MSVS 2017 v15.7.4. I configure the project using cmake-gui. I select the Visual Studio 15 2017 generator and set optional toolset option to LLVM-vs2014. I have LLVM 6.0 x64 installed. CMakeLists.txt: # Boost settings if (WIN32) # According to documentation: # # On Visual Studio and Borland compilers Boost headers request automatically # linking to corresponding libraries. This requires matching libraries to be # linked explicitly or available in the link library search path. In this case # setting Boost_USE_STATIC_LIBS to OFF may not achieve dynamic linking. Boost # automatic linking typically requests static libraries with a few exceptions # (such as Boost.Python). # # That's why for static libraries it is required to explicitly enable static # libraries usage. set (Boost_USE_STATIC_LIBS ON) endif (WIN32) find_package (Boost 1.38.0 REQUIRED COMPONENTS exception) Error message: CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/FindBoost.cmake:2044 (message): Unable to find the requested Boost libraries. Boost version: 1.67.0 Boost include path: W:/boost/1.67.0 Could not find the following static Boost libraries: boost_exception No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): ... I performed a little investigation. It seems that FindBoost module the is distributed with CMake does not support using an alternative toolset with MSVS generator. The function _Boost_GUESS_COMPILER_PREFIX (line 451) checks Intel, MSVC, Borland and MinGW compilers (and general UNIX case). The thing is that CMAKE_CXX_COMPILER_ID for the LLVM-v140 toolset is Clang. As a result, an empty Boost compiler prefix is returned by the function. I managed to workaround the issue by adding the following check before the other checks performed by the _Boost_GUESS_COMPILER_PREFIX function: if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang") if("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "LLVM-vs2010") set(_boost_COMPILER "-vc100") elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "LLVM-vs2012") set(_boost_COMPILER "-vc110") elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "LLVM-vs2013") set(_boost_COMPILER "-vc120") elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "LLVM-vs2014") set(_boost_COMPILER "-vc141;-vc140") endif() else I am not sure that this is the right solution in general, but it has resolved the issue that I had. What is the correct solution for the problem. Best regards, Innokentiy Alaytsev -- 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: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] Performance profiling for CMake scripts?
I am not aware of any built in functionality that can generate performance numbers for a project. Have you made sure that the performance/parsing policies are set to NEW or your cmake_minimum_required is sufficiently high, those can have a significant improvement on configuration time. Polices ( both in CMake 3.1 ) - CMP0054 'if parsing' - CMP0053 'simplified variable reference and escape parsing' On Tue, Jun 19, 2018 at 2:12 PM Robert Dailey wrote: > > So I noticed over the years my CMake scripts take longer and longer to > configure/generate. Is there a mechanism to tell which parts of my > CMake scripts are slowest? I'd like to know how to optimize my CMake > scripts to reduce the time it takes to generate projects. > -- > > 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: > https://cmake.org/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: https://cmake.org/mailman/listinfo/cmake