Re: [CMake] Can not get C++ 11 support enabled
As well as moving the add_executable() call after you set the various CMAKE_CXX... variables, you should also replace the call to add_compile_options(-std=c++11) with the following: set(CMAKE_CXX_EXTENSIONS OFF) On Tue, Jul 11, 2017 at 3:11 PM, Michael Ellerywrote: > > > On Jul 10, 2017, at 10:07 PM, Florian Lindner > wrote: > > > > Hello, > > > > my complete cmake file looks like that: > > > > cmake_minimum_required (VERSION 3.1) > > project(Preallocation) > > add_executable(prealloc prealloc_parallel.cpp) > > > > set(CMAKE_CXX_STANDARD 11) > > set(CMAKE_CXX_STANDARD_REQUIRED ON) > > add_compile_options(-std=c++11) > > > > find_library(petsc petsc > > PATHS $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib) > > if(NOT petsc) > > message(FATAL_ERROR "petsc was not found") > > endif() > > target_link_libraries(prealloc ${petsc}) > > > > find_package(Boost 1.60.0 > > REQUIRED > > COMPONENTS program_options) > > target_link_libraries(prealloc ${Boost_LIBRARIES}) > > > > find_package(MPI > > REQUIRED) > > target_link_libraries(prealloc ${MPI_LIBRARIES}) > > > > set(COMPILE_FLAGS ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}) > > set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS}) > > > > I would try moving the add_executable() to the end of the CMakeLists file > (after the set() and find_library calls…) > > -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 > -- 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: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Can not get C++ 11 support enabled
> On Jul 10, 2017, at 10:07 PM, Florian Lindnerwrote: > > Hello, > > my complete cmake file looks like that: > > cmake_minimum_required (VERSION 3.1) > project(Preallocation) > add_executable(prealloc prealloc_parallel.cpp) > > set(CMAKE_CXX_STANDARD 11) > set(CMAKE_CXX_STANDARD_REQUIRED ON) > add_compile_options(-std=c++11) > > find_library(petsc petsc > PATHS $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib) > if(NOT petsc) > message(FATAL_ERROR "petsc was not found") > endif() > target_link_libraries(prealloc ${petsc}) > > find_package(Boost 1.60.0 > REQUIRED > COMPONENTS program_options) > target_link_libraries(prealloc ${Boost_LIBRARIES}) > > find_package(MPI > REQUIRED) > target_link_libraries(prealloc ${MPI_LIBRARIES}) > > set(COMPILE_FLAGS ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}) > set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS}) > I would try moving the add_executable() to the end of the CMakeLists file (after the set() and find_library calls…) -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
[CMake] Can not get C++ 11 support enabled
Hello, my complete cmake file looks like that: cmake_minimum_required (VERSION 3.1) project(Preallocation) add_executable(prealloc prealloc_parallel.cpp) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_compile_options(-std=c++11) find_library(petsc petsc PATHS $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib) if(NOT petsc) message(FATAL_ERROR "petsc was not found") endif() target_link_libraries(prealloc ${petsc}) find_package(Boost 1.60.0 REQUIRED COMPONENTS program_options) target_link_libraries(prealloc ${Boost_LIBRARIES}) find_package(MPI REQUIRED) target_link_libraries(prealloc ${MPI_LIBRARIES}) set(COMPILE_FLAGS ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}) set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS}) but still, cmake refused to enable c++11 support, make VERBOSE=1 shows [ 50%] Building CXX object CMakeFiles/prealloc.dir/prealloc_parallel.cpp.o /usr/bin/c++ -O3 -DNDEBUG -o CMakeFiles/prealloc.dir/prealloc_parallel.cpp.o -c /data/scratch/lindnefn/petsc_prealloc/prealloc_parallel.cpp In file included from /usr/include/c++/5/random:35:0, from /data/scratch/lindnefn/petsc_prealloc/prealloc_parallel.cpp:4: /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support \ ^ In file included from /data/scratch/lindnefn/software/petsc/include/petscis.h:7:0, from /data/scratch/lindnefn/software/petsc/include/petscvec.h:9, from /data/scratch/lindnefn/software/petsc/include/petscmat.h:6, from /data/scratch/lindnefn/petsc_prealloc/prealloc_parallel.cpp:7: /data/scratch/lindnefn/software/petsc/include/petscsys.h:130:17: fatal error: mpi.h: No such file or directory compilation terminated. What is wrong here+ cmake 3.5.1 Thanks, Florian -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[Cmake-commits] CMake branch, master, updated. v3.9.0-rc5-256-ge1476f9
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e1476f96189fd361045d68fca60978106d8ee6e1 (commit) from 1fda77d45565c3a819e6149597c3a194d9ccd0bb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1476f96189fd361045d68fca60978106d8ee6e1 commit e1476f96189fd361045d68fca60978106d8ee6e1 Author: Kitware Robot <kwro...@kitware.com> AuthorDate: Tue Jul 11 00:01:08 2017 -0400 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jul 11 00:01:08 2017 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2d86e33..0a8e870 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 9) -set(CMake_VERSION_PATCH 20170710) +set(CMake_VERSION_PATCH 20170711) #set(CMake_VERSION_RC 1) --- Summary of changes: Source/CMakeVersion.cmake |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits
Re: [CMake] Non OBJECT libraries and population of $
Thanks for the excellent suggestion. Unfortunately we can't really use for Visual Studio. The problem is that the two "add_library" calls result in two visual studio projects. The problem with this is that our generated Visual Studio solution already has 300 odd projects, using you suggestion would result in maybe 500 odd. We are already on the limit of projects in Visual Studio before the IDE becomes unusable. We could of course split the software up into multiple solutions but we are very loath to do this. However it's a great solution for our Ninja builds, so thanks. On Mon, Jul 10, 2017 at 12:09 PM, Petr Kmochwrote: > Hi David. > > In your particular case, you don't have build everything twice. Just make > the SHARED libraries thin wrappers around the OBJECT libraries. Like this: > > add_library(obj1 OBJECT a.cpp b.cpp ...) > add_library(lib1 SHARED $) > > add_library(obj2 OBJECT c.cpp d.cpp ...) > add_library(lib2 SHARED $) > > add_library(combined SHARED $ $) > > Petr > > On 10 July 2017 at 19:41, David Hunter wrote: >> >> Currently you can create an OBJECT library using "add_library( >> OBJECT ...)" this populates $ which can then >> later be used using something like >> "target_sources(name PUBLIC $)". I am wondering if >> there is some reason that $ can't be populated when >> you create a shared or static library, for instance using >> "add_library( SHARED ...)". Looking at the output the VS 2017 >> generators for "add_library( OBJECT ...)" it seems to actually >> build a static library anyway. I suspect that all the files are >> compiled to object files somewhere for both STATIC and SHARED libraries, >> if so would it not be possible to point $ as these >> object files? >> >> The reason I ask is that we have a a bunch of source code that builds >> in about 100 projects. These projects have a normal hierarchical >> dependency tree. However when distributing we want to create larger >> libraries that are the combination of various subsets of the smaller ones. >> In automake these are called convenience libraries and I suspect they may >> have been the reason for CMake OBJECT in the first place. Given the >> current >> behaviour we have to build all the projects twice once in SHARED library >> form on once in OBJECT library form. If TARGET_OBJECTS was populated for >> SHARED libraries we would not need to build everything twice as we could >> build everything SHARED but still use TARGET_OBJECTS to build combination >> convenience libraries. >> >> Of course maybe there's already a way to do this without having to >> build twice which I don't know about. > > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Cannot get a 64-bit build of MySQL on a 64-bit Windows machine
I am completely new to CMake, and am using to build MySQL 5.7.18 on Windows 10 x64, using the following command: cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DENABLE_DOWNLOADS=1 I have VS 2017 installed, and I am on 64 bit machine, but for some reason, the above command produces the following output: The CXX compiler identification is MSVC 19.10.25019.0 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe -- works The correct compiler is in the HostX64/x64 folder. Thinking that CMake might be looking it up from there, I checked the processor architecture environment variable from the same cmd.exe that I launched the CMake command from, and here's the result: PROCESSOR_ARCHITECTURE=AMD64 When I follow the above CMake command with the following: devenv MySQL.sln /build RelWithDebInfo I get 32-bit results generated, which is not what I want. How can I get CMake to generate a 64-bit build? Thanks so much. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] cmake create executable Undefined symbols for architecture x86_64:
On 07-07-17 05:14, Sean Wayland wrote: > Hi Micha, > Thanks very much for the email. That seemed to make a small > difference! With both those lines commented out these errors are > generated ( below my email ) . > I still have included > project(CATSMAT) > at the top line of the cmake file in the catsmat directory > > I tried commenting out each of those language type definitions > separately but it didn't seem to help. > The code compiles under xcode. Those language types ( C++14) are > specified in Xcode so I was trying to find a way to copy what is in > xcode. > > Is there a maximum number of "errors" before the clion compiler will > spit the dummy ? > > Another executable will compile with lots and lots of warnings but no "errors" > > I don't know much about C++ unfortunately. These errors look like > simple errors which I could see might be generated if the syntax of > the language had changed slightly from one version to the next .. > > Thanks for you help! > > Sean > > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: > error: ISO C++ forbids forward references to 'enum' types > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: > error: expected '(' for function-style cast or type construction > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: > error: field has incomplete type 'enum direction' > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: > error: ISO C++ forbids forward references to 'enum' types > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: > error: expected '(' for function-style cast or type construction > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: > error: field has incomplete type 'enum direction' > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > >^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: > note: forward declaration of 'IMUSANT::direction' > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: > error: ISO C++ forbids forward references to 'enum' types > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: > error: expected '(' for function-style cast or type construction > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:20: > error: field has incomplete type 'enum basic' > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > > sers/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: > error: ISO C++ forbids forward references to 'enum' types > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: > error: expected '(' for function-style cast or type construction > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:20: > error: field has incomplete type 'enum basic' > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > > > >
Re: [CMake] How to have build steps operate on files in a copied directory?
It appears to be so -- the install directives execute in incident order, at least from within a single CMakeLists.txt file. The solution ended up being INSTALL(CODE "execute_process(COMMAND ...)"). Feels like a bit of a hack, but the install works on two different platforms -- I'm satisfied for now. Thanks again for the help! CR On Mon, Jul 10, 2017 at 6:25 PM, Michael Ellerywrote: > > > On Jul 10, 2017, at 11:19 AM, Christopher E Robison < > cerobi...@utexas.edu> wrote: > > > Can I specify somehow that this install command must be executed after > the INSTALL(DIRECTORY ...) command has completed? > > I *believe* the install directives are executed in the order they are > encountered in the processing of CMakeLists files, so putting the custom > step as the last item in your top level CMake file might do the trick. > > > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] How to have build steps operate on files in a copied directory?
> On Jul 10, 2017, at 11:19 AM, Christopher E Robison> wrote: > > The INSTALL(SCRIPT ...) syntax might be just the answer I need, thanks!. > > As I mentioned, the index creating script in the custom step needs to operate > on the copied directory tree in its final location, so if it's not all there > yet it will fail. So, if CMake has some distinction between "build" and > "install" (I'm familiar with Makefiles, where the syntax enforces no such > separation -- just targets, dependencies, and commands), then this would mean > the step has to be executed at the end of the "install" phase. > > Can I specify somehow that this install command must be executed after the > INSTALL(DIRECTORY ...) command has completed? > > > Thanks, > CR > > I *believe* the install directives are executed in the order they are encountered in the processing of CMakeLists files, so putting the custom step as the last item in your top level CMake file might do the trick. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] How to have build steps operate on files in a copied directory?
The INSTALL(SCRIPT ...) syntax might be just the answer I need, thanks!. As I mentioned, the index creating script in the custom step needs to operate on the copied directory tree in its final location, so if it's not all there yet it will fail. So, if CMake has some distinction between "build" and "install" (I'm familiar with Makefiles, where the syntax enforces no such separation -- just targets, dependencies, and commands), then this would mean the step has to be executed at the end of the "install" phase. Can I specify somehow that this install command must be executed after the INSTALL(DIRECTORY ...) command has completed? Thanks, CR On Mon, Jul 10, 2017 at 6:04 PM, Michael Ellerywrote: > > > On Jul 10, 2017, at 10:46 AM, Christopher E Robison < > cerobi...@utexas.edu> wrote: > > > > I've recently begun using CMake on an existing project I've taken over, > and I feel like I'm mostly getting used to it, though there is still a vast > amount to learn. I've got nearly the entire project building successfully, > with the exception of a directory of external scripts that need to be > configured at the end of the install process to create some index files. > > > > So, in a nutshell, there's a script that takes care of this post-install > configuration, that needs to be executed once the target tree of > directories and script files are in place, copied from the source tree. And > I'm finding that when the script is called during the build, the > INSTALL(DIRECTORY ...) command from the CMakeLists.txt directory hasn't > been run yet, so the tree of script files hasn't been put in place yet and > the script (and the build) fails. > > > > FWIW, if I leave out the add_custom_command and add_custom_target that > execute the script, the directory tree does copy correctly. > > > > I have not found any guidance on how to specify that the directory tree > gets copied first. How is this normally done? > > > > > > Thanks, > > CR > > > > > > > > I think you might be getting confused by two distinct phases: BUILD and > INSTALL. > > BUILD is what happens when building your sources and all the results of > this step are in your build directory (or source directory if you do > in-source building). Both add_custom_command and add_custom_target are > evaluated (and potentially executed) at BUILD time. The BUILD phase is > what is processed when you just do “make” in Makefile terms. > > INSTALL is what happens when you request your project to be installed. The > various install() directives in your CMake files will be processed during > INSTALL. In Makefile terms, this what happens when you do “make install” > (BUILD is also done in that case since INSTALL always depends on BUILD) > > So the first question is: does this custom step need to be done at BUILD > time or INSTALL time? Running custom code is easier at BUILD time since you > have the add_custom_command and the like. If you need to run custom code at > INSTALL time, maybe consider this: > > https://stackoverflow.com/questions/41254902/cmake-run- > script-for-install-target > > …although I have not done something like this myself. I suspect it is > difficult to get just right, depending on the various platforms you support. > > Does that make sense? > > -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
Re: [CMake] Non OBJECT libraries and population of $
Hi David. In your particular case, you don't have build everything twice. Just make the SHARED libraries thin wrappers around the OBJECT libraries. Like this: add_library(obj1 OBJECT a.cpp b.cpp ...) add_library(lib1 SHARED $) add_library(obj2 OBJECT c.cpp d.cpp ...) add_library(lib2 SHARED $) add_library(combined SHARED $ $) Petr On 10 July 2017 at 19:41, David Hunterwrote: > Currently you can create an OBJECT library using "add_library( > OBJECT ...)" this populates $ which can then > later be used using something like > "target_sources(name PUBLIC $)". I am wondering if > there is some reason that $ can't be populated when > you create a shared or static library, for instance using > "add_library( SHARED ...)". Looking at the output the VS 2017 > generators for "add_library( OBJECT ...)" it seems to actually > build a static library anyway. I suspect that all the files are > compiled to object files somewhere for both STATIC and SHARED libraries, > if so would it not be possible to point $ as these > object files? > > The reason I ask is that we have a a bunch of source code that builds > in about 100 projects. These projects have a normal hierarchical > dependency tree. However when distributing we want to create larger > libraries that are the combination of various subsets of the smaller ones. > In automake these are called convenience libraries and I suspect they may > have been the reason for CMake OBJECT in the first place. Given the current > behaviour we have to build all the projects twice once in SHARED library > form on once in OBJECT library form. If TARGET_OBJECTS was populated for > SHARED libraries we would not need to build everything twice as we could > build everything SHARED but still use TARGET_OBJECTS to build combination > convenience libraries. > > Of course maybe there's already a way to do this without having to > build twice which I don't know about. > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] How to have build steps operate on files in a copied directory?
> On Jul 10, 2017, at 10:46 AM, Christopher E Robison> wrote: > > I've recently begun using CMake on an existing project I've taken over, and I > feel like I'm mostly getting used to it, though there is still a vast amount > to learn. I've got nearly the entire project building successfully, with the > exception of a directory of external scripts that need to be configured at > the end of the install process to create some index files. > > So, in a nutshell, there's a script that takes care of this post-install > configuration, that needs to be executed once the target tree of directories > and script files are in place, copied from the source tree. And I'm finding > that when the script is called during the build, the INSTALL(DIRECTORY ...) > command from the CMakeLists.txt directory hasn't been run yet, so the tree of > script files hasn't been put in place yet and the script (and the build) > fails. > > FWIW, if I leave out the add_custom_command and add_custom_target that > execute the script, the directory tree does copy correctly. > > I have not found any guidance on how to specify that the directory tree gets > copied first. How is this normally done? > > > Thanks, > CR > > > I think you might be getting confused by two distinct phases: BUILD and INSTALL. BUILD is what happens when building your sources and all the results of this step are in your build directory (or source directory if you do in-source building). Both add_custom_command and add_custom_target are evaluated (and potentially executed) at BUILD time. The BUILD phase is what is processed when you just do “make” in Makefile terms. INSTALL is what happens when you request your project to be installed. The various install() directives in your CMake files will be processed during INSTALL. In Makefile terms, this what happens when you do “make install” (BUILD is also done in that case since INSTALL always depends on BUILD) So the first question is: does this custom step need to be done at BUILD time or INSTALL time? Running custom code is easier at BUILD time since you have the add_custom_command and the like. If you need to run custom code at INSTALL time, maybe consider this: https://stackoverflow.com/questions/41254902/cmake-run-script-for-install-target …although I have not done something like this myself. I suspect it is difficult to get just right, depending on the various platforms you support. Does that make sense? -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
[CMake] How to have build steps operate on files in a copied directory?
I've recently begun using CMake on an existing project I've taken over, and I feel like I'm mostly getting used to it, though there is still a vast amount to learn. I've got nearly the entire project building successfully, with the exception of a directory of external scripts that need to be configured at the end of the install process to create some index files. So, in a nutshell, there's a script that takes care of this post-install configuration, that needs to be executed once the target tree of directories and script files are in place, copied from the source tree. And I'm finding that when the script is called during the build, the INSTALL(DIRECTORY ...) command from the CMakeLists.txt directory hasn't been run yet, so the tree of script files hasn't been put in place yet and the script (and the build) fails. FWIW, if I leave out the add_custom_command and add_custom_target that execute the script, the directory tree does copy correctly. I have not found any guidance on how to specify that the directory tree gets copied first. How is this normally done? Thanks, CR -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Non OBJECT libraries and population of $
Currently you can create an OBJECT library using "add_library( OBJECT ...)" this populates $ which can then later be used using something like "target_sources(name PUBLIC $)". I am wondering if there is some reason that $ can't be populated when you create a shared or static library, for instance using "add_library( SHARED ...)". Looking at the output the VS 2017 generators for "add_library( OBJECT ...)" it seems to actually build a static library anyway. I suspect that all the files are compiled to object files somewhere for both STATIC and SHARED libraries, if so would it not be possible to point $ as these object files? The reason I ask is that we have a a bunch of source code that builds in about 100 projects. These projects have a normal hierarchical dependency tree. However when distributing we want to create larger libraries that are the combination of various subsets of the smaller ones. In automake these are called convenience libraries and I suspect they may have been the reason for CMake OBJECT in the first place. Given the current behaviour we have to build all the projects twice once in SHARED library form on once in OBJECT library form. If TARGET_OBJECTS was populated for SHARED libraries we would not need to build everything twice as we could build everything SHARED but still use TARGET_OBJECTS to build combination convenience libraries. Of course maybe there's already a way to do this without having to build twice which I don't know about. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[Cmake-commits] CMake branch, master, updated. v3.9.0-rc5-255-g1fda77d
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1fda77d45565c3a819e6149597c3a194d9ccd0bb (commit) via 41be8a739e862995e56aad33e2383c2278a91b77 (commit) via 4bf96ed9b01a31e0c91e101b913fa5eb64b99432 (commit) via 9eaf0fea2824b2e0b767915dec25deed9552905a (commit) via 9b9a57e16b22769b612d4bbe45e9b7cb936be690 (commit) via 916b7d519557d4d11e73e66c3e9c95cdacb655ba (commit) via e7730d78b44ca90aa8ee6d1f34495cd416888bce (commit) via 9a34e95a41fff294a7fcd452cb3e78fd4ff021aa (commit) via 58f47448210bf3fd3121bf91f74eb893ba9d034c (commit) from fc58819150a126d87bf17ad812bb6f62f28ae42b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1fda77d45565c3a819e6149597c3a194d9ccd0bb commit 1fda77d45565c3a819e6149597c3a194d9ccd0bb Merge: 41be8a7 9b9a57e Author: Brad KingAuthorDate: Mon Jul 10 10:23:56 2017 -0400 Commit: Brad King CommitDate: Mon Jul 10 10:23:56 2017 -0400 Merge branch 'release-3.9' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41be8a739e862995e56aad33e2383c2278a91b77 commit 41be8a739e862995e56aad33e2383c2278a91b77 Merge: 4bf96ed 9a34e95 Author: Brad King AuthorDate: Mon Jul 10 14:21:47 2017 + Commit: Kitware Robot CommitDate: Mon Jul 10 10:22:00 2017 -0400 Merge topic 'autogen-no-generated-files' 9a34e95a Autogen: Skip generated files for compatibility with CMake 3.8 Acked-by: Kitware Robot Merge-request: !1033 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4bf96ed9b01a31e0c91e101b913fa5eb64b99432 commit 4bf96ed9b01a31e0c91e101b913fa5eb64b99432 Merge: 9eaf0fe e7730d7 Author: Brad King AuthorDate: Mon Jul 10 14:21:12 2017 + Commit: Kitware Robot CommitDate: Mon Jul 10 10:21:23 2017 -0400 Merge topic 'find_package-restore-considered-configs' e7730d78 find_package: Restore longer message when config files were considered Acked-by: Kitware Robot Merge-request: !1032 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9eaf0fea2824b2e0b767915dec25deed9552905a commit 9eaf0fea2824b2e0b767915dec25deed9552905a Merge: fc58819 58f4744 Author: Brad King AuthorDate: Mon Jul 10 14:20:26 2017 + Commit: Kitware Robot CommitDate: Mon Jul 10 10:21:00 2017 -0400 Merge topic 'indented_cmakedefine' 58f47448 configure_file: Add support for indented cmakedefine Acked-by: Kitware Robot Merge-request: !1024 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58f47448210bf3fd3121bf91f74eb893ba9d034c commit 58f47448210bf3fd3121bf91f74eb893ba9d034c Author: Sylvain Joubert AuthorDate: Tue Jul 4 12:00:02 2017 +0200 Commit: Sylvain Joubert CommitDate: Tue Jul 4 12:00:02 2017 +0200 configure_file: Add support for indented cmakedefine Optional spaces and/or tabs are now understood between the '#' character and the 'cmakedefine'/'cmakedefine01' words. This indentation is preserved in the output lines. Fixes: #13037 diff --git a/Help/command/configure_file.rst b/Help/command/configure_file.rst index 4304f09..75ec441 100644 --- a/Help/command/configure_file.rst +++ b/Help/command/configure_file.rst @@ -30,6 +30,18 @@ a false constant by the :command:`if` command. The "..." content on the line after the variable name, if any, is processed as above. Input file lines of the form ``#cmakedefine01 VAR`` will be replaced with either ``#define VAR 1`` or ``#define VAR 0`` similarly. +The result lines (with the exception of the ``#undef`` comments) can be +indented using spaces and/or tabs between the ``#`` character +and the ``cmakedefine`` or ``cmakedefine01`` words. This whitespace +indentation will be preserved in the output lines:: + + # cmakedefine VAR + # cmakedefine01 VAR + +will be replaced, if ``VAR`` is defined, with:: + + # define VAR + # define VAR 1 If the input file is modified the build system will re-run CMake to re-configure the file and generate the build system again. diff --git a/Help/release/dev/indented_cmakedefine.rst b/Help/release/dev/indented_cmakedefine.rst new file mode 100644 index 000..fd28b25 --- /dev/null +++ b/Help/release/dev/indented_cmakedefine.rst @@ -0,0 +1,7 @@ +indented_cmakedefine + + +* The :command:`configure_file` command
[Cmake-commits] CMake branch, release, updated. v3.9.0-rc5-23-g9b9a57e
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 9b9a57e16b22769b612d4bbe45e9b7cb936be690 (commit) via 916b7d519557d4d11e73e66c3e9c95cdacb655ba (commit) via e7730d78b44ca90aa8ee6d1f34495cd416888bce (commit) via 9a34e95a41fff294a7fcd452cb3e78fd4ff021aa (commit) from 658ecc1a7cab54aeb738a00e7fee24aa4bd18adb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - --- Summary of changes: Source/cmFindPackageCommand.cxx |3 ++- Source/cmQtAutoGeneratorInitializer.cxx |7 +++ Tests/QtAutogen/mocDepends/CMakeLists.txt |2 ++ Tests/QtAutogen/mocRerun/CMakeLists.txt |1 + Tests/RunCMake/find_package/RunCMakeTest.cmake |2 ++ Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt|9 + Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt|1 - .../find_package/VersionedA-1/VersionedAConfig.cmake|0 .../find_package/VersionedA-1/VersionedAConfigVersion.cmake |4 .../find_package/VersionedA-2/VersionedAConfig.cmake|0 .../VersionedA-2/VersionedAConfigVersion.cmake} |3 +-- Tests/RunCMake/find_package/WrongVersion-stderr.txt | 11 +++ Tests/RunCMake/find_package/WrongVersion.cmake |2 ++ Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt | 11 +++ Tests/RunCMake/find_package/WrongVersionConfig.cmake|2 ++ 15 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt delete mode 100644 Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake (100%) create mode 100644 Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake (100%) copy Tests/{FindPackageTest/lib/zot-2.0/zot-config-version.cmake => RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake} (77%) create mode 100644 Tests/RunCMake/find_package/WrongVersion-stderr.txt create mode 100644 Tests/RunCMake/find_package/WrongVersion.cmake create mode 100644 Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt create mode 100644 Tests/RunCMake/find_package/WrongVersionConfig.cmake hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits