Re: [CMake] externalproject_add and generating sources
You'll also want to build your own project with ExternalProject, and use the DEPENDS option to control build order. This ensures that all dependencies are fully installed before your own project is even configured. The project with all the ExternalProject calls is typically called a superbuild, and effectively becomes an optional convenience to building your own project. On Thu, Jan 26, 2017 at 3:23 AM, David Jobet wrote: > Hello, > > suppose I want to use protobuf and integrate it in my project with > externalproject_add. (actually, I just have precompiled binaries and libs + > header files, I don't have the full sources) > Once the project has been 'built' (actually, installed by a custom > rpm-like tool to a shared path), I can use the protoc compiler to generate > protobuf c++ files (.pb.h and .pb.cpp files) from a .proto description file. > I can add_dependencies so that the external project is built before > projects depending on libprotobuf.a. > > However, I don't know how to do the same thing with .pb.h and .pb.cpp > files which use a .proto file and the protoc compiler. > > make is fine with it, but ninja complains with an error like this : > ninja: error: '/path_to_external_projects/protobuf/2.6.0.4/bin/protoc', > needed by 'some_project/SomeFile.pb.h', missing and no known rule to make it > > how can I tell ninja that protoc is going to be provided by > externalproject ? > If I use byproducts, ninja is happy, but "ninja clean" deletes > /path_to_external_projects/protobuf/2.6.0.4/bin/protoc. > I don't want that to happen since /path_to_external_projects/protobuf/ > 2.6.0.4/bin/protoc is shared with other users. > > With 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 > -- 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] ExternalProject_Add
Yes, that is what I do in my superbuilds. Generally I make is such that my project could be built without the superbuild, and the superbuild is just a convenience. On Sat, Jan 21, 2017 at 12:17 PM, Saad Khattak wrote: > >> One possibility is the often mentioned superbuild > > That is a tempting and I started to go down that route - however, I ran > into a problem where my project (which is now also built using > ExternalProject_Add) does not have access to the CMake variables. Is the > only solution to pass them through the CMAKE_ARGS variable in > ExternalProject_Add? > > On Mon, Jan 9, 2017 at 12:07 AM Hendrik Sattler > wrote: > > One possibility is the often mentioned superbuild, another is not using > find_library() but setting the variables with the library file paths > manually (that's static info anyway). > > > Am 8. Januar 2017 22:49:52 MEZ schrieb Saad Khattak >: > >Hello, > > > >I have an external project glfw that I added to my project like this: > > > >== > >include(ExternalProject) > >ExternalProject_Add(glfw > > GIT_REPOSITORY "https://github.com/glfw/glfw.git"; > > GIT_TAG "master" > > > > SOURCE_DIR "${CMAKE_SOURCE_DIR}/dep/glfw" > > CMAKE_ARGS -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF > >-DGLFW_BUILD_EXAMPLES=OFF > >-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/install/glfw/ > >-DCMAKE_DEBUG_POSTFIX=_d > > > > TEST_COMMAND "" > > ) > >set(GLFW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/install/glfw/include/") > >set(GLFW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/install/glfw/lib/") > >== > > > >Then I include it in my project like so: > > > >== > >find_library(GLFW_LIB_D glfw3_d ${GLFW_LIBRARY_DIR}) > >find_library(GLFW_LIBglfw3 ${GLFW_LIBRARY_DIR}) > > > >include_directories(${GLFW_INCLUDE_DIR}) > > > >add_executable(vk_test > > src/vulkan_test.cpp > > ) > >target_link_libraries(vk_test debug ${GLFW_LIB_D} optimized > >${GLFW_LIB}) > >add_dependencies(vk_test glfw) > >== > > > >As you can see, I depend on the libraries compiled by the external > >project > >glfw. Unfortunately, when I first configure the project, CMake > >complains > >that it cannot find the libraries specified by ${GLFW_LIB_D} and > >${GLFW_LIB} variables. > > > >Of course, this is because CMake did not begin cloning, configuring and > >building the glfw project. That only happens AFTER my project has been > >configured and starts building. This becomes a chicken and the egg > >problem. > > > >Currently, my solution is to add dummy .lib files so that I can at > >least > >configure and generate my project. My question is, am I approaching > >this > >problem in the wrong way? If yes, what is the correct way to add a > >dependency to an external project and have it clone/configure/build > >BEFORE > >the "find_library" call? > > -- > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail > gesendet. > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/ > opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] ExternalProject_Add
The way to solve this is to use a superbuild project layout - you use ExternalProject_Add to build your dependencies AND your own project, using the DEPENDS option to control build order. Thus by the time it gets around to configuring your project, the dependencies have already been built and installed fully. On Sun, Jan 8, 2017 at 3:49 PM, Saad Khattak wrote: > Hello, > > I have an external project glfw that I added to my project like this: > > == > include(ExternalProject) > ExternalProject_Add(glfw > GIT_REPOSITORY "https://github.com/glfw/glfw.git"; > GIT_TAG "master" > > SOURCE_DIR "${CMAKE_SOURCE_DIR}/dep/glfw" > CMAKE_ARGS -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF > -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=${ > CMAKE_SOURCE_DIR}/install/glfw/ -DCMAKE_DEBUG_POSTFIX=_d > > TEST_COMMAND "" > ) > set(GLFW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/install/glfw/include/") > set(GLFW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/install/glfw/lib/") > == > > Then I include it in my project like so: > > == > find_library(GLFW_LIB_D glfw3_d ${GLFW_LIBRARY_DIR}) > find_library(GLFW_LIBglfw3 ${GLFW_LIBRARY_DIR}) > > include_directories(${GLFW_INCLUDE_DIR}) > > add_executable(vk_test > src/vulkan_test.cpp > ) > target_link_libraries(vk_test debug ${GLFW_LIB_D} optimized ${GLFW_LIB}) > add_dependencies(vk_test glfw) > == > > As you can see, I depend on the libraries compiled by the external project > glfw. Unfortunately, when I first configure the project, CMake complains > that it cannot find the libraries specified by ${GLFW_LIB_D} and > ${GLFW_LIB} variables. > > Of course, this is because CMake did not begin cloning, configuring and > building the glfw project. That only happens AFTER my project has been > configured and starts building. This becomes a chicken and the egg problem. > > Currently, my solution is to add dummy .lib files so that I can at least > configure and generate my project. My question is, am I approaching this > problem in the wrong way? If yes, what is the correct way to add a > dependency to an external project and have it clone/configure/build BEFORE > the "find_library" call? > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/ > opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] ExternalProject_Add not honoring the INSTALL_DIR argument.
Hmm, you're right, I just tested and it seems the INSTALL_DIR is ignored or not handled properly, I'm not sure why. But if you use the CMAKE_ARGS option to manually set "-DCMAKE_INSTALL_PREFIX=/tmp/Fusion/qhull-2015.2" it works, so at least there's an easy workaround. Maybe someone else knows how the INSTALL_DIR option is meant to be used? On Mon, Aug 29, 2016 at 11:00 AM, Michael Jackson wrote: > So that was a typo on my part but changing it had no effect after deleting > every build/download/tmp/stamp directory and trying again. > > -- > Michael A. Jackson > BlueQuartz Software, LLC > [e]: mike.jack...@bluequartz.net > > > Nicholas Braden wrote: >> >> Have you tried changing the = to a space, as with the other parameters? >> >> On Mon, Aug 29, 2016 at 10:52 AM, Michael Jackson >> wrote: >>> >>> I have the following CMake file: >>> >>> set(QHull_GIT_REPO "git://github.com/qhull/qhull") >>> set(QHull_GIT_TAG "") >>> set(QHull_INSTALL_NAME "qhull") >>> set(QHull_INSTALL_NAME "qhull-2015.2") >>> >>> >>> ExternalProject_Add(${QHull_INSTALL_NAME} >>>PREFIX ${Fusion_SDK_ROOT} >>>URL "http://www.qhull.org/download/qhull-2015-src-7.2.0.tgz"; >>>INSTALL_DIR=/tmp/Fusion/qhull-2015.2 >>> LOG_DOWNLOAD 1 >>> LOG_UPDATE 1 >>> LOG_CONFIGURE 1 >>> LOG_BUILD 1 >>> LOG_INSTALL 1 >>> >>> ) >>> >>> and when I invoke the initial cmake with this: >>> >>> cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release >>> -DFusion_SDK_ROOT=/tmp/Fusion_SDK ../ >>> >>> I get a valid "configure" step. Then I run "ninja" and I get errors on >>> installation. The errors are because CMake is attempting to install QHull >>> in >>> /usr/local/lib. >>> >>> Why is that? I am not sure what I am doing wrong as this seems like a >>> pretty >>> trivial case. I have cmake 3.5.1 and read the docs at >>> https://cmake.org/cmake/help/v3.5/module/ExternalProject.html but somehow >>> cmake is messing up. >>> >>> Thoughts? >>> >>> >>> -- >>> Michael A. Jackson >>> BlueQuartz Software, LLC >>> [e]: mike.jack...@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 > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] ExternalProject_Add not honoring the INSTALL_DIR argument.
Have you tried changing the = to a space, as with the other parameters? On Mon, Aug 29, 2016 at 10:52 AM, Michael Jackson wrote: > I have the following CMake file: > > set(QHull_GIT_REPO "git://github.com/qhull/qhull") > set(QHull_GIT_TAG "") > set(QHull_INSTALL_NAME "qhull") > set(QHull_INSTALL_NAME "qhull-2015.2") > > > ExternalProject_Add(${QHull_INSTALL_NAME} > PREFIX ${Fusion_SDK_ROOT} > URL "http://www.qhull.org/download/qhull-2015-src-7.2.0.tgz"; > INSTALL_DIR=/tmp/Fusion/qhull-2015.2 > LOG_DOWNLOAD 1 > LOG_UPDATE 1 > LOG_CONFIGURE 1 > LOG_BUILD 1 > LOG_INSTALL 1 > > ) > > and when I invoke the initial cmake with this: > > cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release > -DFusion_SDK_ROOT=/tmp/Fusion_SDK ../ > > I get a valid "configure" step. Then I run "ninja" and I get errors on > installation. The errors are because CMake is attempting to install QHull in > /usr/local/lib. > > Why is that? I am not sure what I am doing wrong as this seems like a pretty > trivial case. I have cmake 3.5.1 and read the docs at > https://cmake.org/cmake/help/v3.5/module/ExternalProject.html but somehow > cmake is messing up. > > Thoughts? > > > -- > Michael A. Jackson > BlueQuartz Software, LLC > [e]: mike.jack...@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 -- 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] Convert UTF8 to UTF16 (Windows)
Are you sure about this UTF16 requirement? I have many projects ranging from Visual Studio 2008 to 2015 that use .rc files and all of them are ANSI/UTF8. On Mon, Aug 29, 2016 at 2:43 AM, tonka tonka wrote: > Hey, > > I have a little problem with files which has to be UTF 16 instead of UTF 8, > f.e. Visual studios .rc files. They must be utf16 and git detect it as bin > files. > So my question is: how do you handle these files? > My rc files has to be generated with configure_file, so my hope was that > configure_file will read utf8 and write utf16 if I want, but that seems not > possible. > Is there and other way in cake to convert to utf16? > > Greetings > Tonka > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] How to add -fPIC to a static library?
Have you tried set_property(TARGET cpp-netlib_pic PROPERTY POSITION_INDEPENDENT_CODE ON)? I think you must specify the value ON for it to work. On Sun, Aug 28, 2016 at 4:28 PM, Steve Lorimer wrote: > I'm trying to create a static library with -fPIC specified. > > add_library(cpp-netlib_pic > STATIC > ${SRCS}) > set_property(TARGET cpp-netlib_pic PROPERTY POSITION_INDEPENDENT_CODE) > > This doesn't work. > > The library (cpp-netlib_pic) is built without the -fPIC flags. > > Other targets which link against cpp-netlib_pic have -fPIC added to their > compiler flags, but the linking fails because cpp-netlib_pic didn't. > > Here foo will have -fPIC added: > > add_library(foo > SHARED > ${SRCS}) > target_link_libraries(foo cpp-netlib_pic) > > > I've proved this to myself with make VERBOSE=1 > > [ 87%] Building CXX object > third_party/cpp-netlib/CMakeFiles/cpp-netlib_pic.dir/src/server_request_parsers_impl.cpp.o > > /usr/bin/c++ ... -std=c++14 -Werror -Wall -Wextra ... -o > CMakeFiles/cpp-netlib_pic.dir/src/server_request_parsers_impl.cpp.o -c > .../third_party/cpp-netlib/src/server_request_parsers_impl.cpp > > Note no -fPIC here. > > When building a target which uses cpp-netlib_pic -fPIC appears: > > [ 93%] Building CXX object foo.cc.o > /usr/bin/c++ ... -std=c++14 -Werror -Wall -Wextra ... -fPIC ... -o > CMakeFiles/foo_shared_lib.dir/foo.cc.o -c .../foo/foo.cc > > How can I configure CMake to build the 1st library (cpp-netlib_pic) with > -fPIC? > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Private dependencies of static libraries exported as targets
Ah! When I do that, it also solves the include path bloat issue. No longer does `client` know about the include directory of `bar`. Seems it was a difference in minimum CMake version respecting old behavior. In FooTargets.cmake, I see this line: INTERFACE_LINK_LIBRARIES "\$" Awesome. Of course, this only helps Ivan if they can use CMake >= 3.0 - still good to know that the solution is simple. On Thu, Aug 18, 2016 at 8:29 AM, Tamás Kenéz wrote: > Ivan, > >> But, if library `foo` is built as static, then its clients suddenly >> become required to link to `bar` as well, and this information is not >> recorded anywhere! > > I changed the cmake_minimum_required version in your projects from 2.8 to > 3.0 which fixed the issue. > (I tried it with cmake 3.6.1) > > Tamas > > On Wed, Aug 17, 2016 at 2:55 PM, Ivan Shapovalov > wrote: >> >> On 2016-08-17 at 05:19 -0500, Nicholas Braden wrote: >> > Huh, this is weird. It seems to be an issue with the export/import >> > mechanism. If you make a project where everything is in the same >> > CMakeLists.txt and there is no install step, there is no include >> > directory pollution. See my attached project for example. On my >> > system >> > I run this to build: >> > >> > mkdir build && cd build && cmake -G "MinGW Makefiles" .. && cmake >> > --build . -- VERBOSE=1 >> > >> > When it builds main: >> > >> > C:\MinGW\bin\g++.exe@CMakeFiles/main.dir/includes_CXX.rsp >> > -std=gnu++14 -o CMakeFiles\main.dir\main.cpp.obj -c >> > C:\Users\LB\Code\cmake-private-static-dependencies\main.cpp >> > >> > The entirety of the includes_CXX.rsp file: >> > >> > -IC:/Users/LB/Code/cmake-private-static-dependencies/c >> > >> > The project you provided definitely has the include directory >> > pollution problem - the client includes_CXX.rsp file contains an >> > -isystem directive for bar. It looks like the generated >> > FooTargets-noconfig.cmake contains this line (setting properties on >> > foo): >> > >> > IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "bar" >> > >> > I'm not fully sure but I think this is wrong because it is saying >> > that >> > bar is a public dependency. This seems to be an oversight in CMake, >> > as >> > there is no 'private' alternative of the above variable for imported >> > targets - that is, there is no IMPORTED_LINK_LIBRARIES_NOCONFIG, thus >> > there is no way for CMake to provide special treatment as in my >> > example. It seems CMake literally converts private dependencies of >> > static libraries to public dependencies only when using the export >> > functionality. >> > >> > ...and that's as much as I can figure right now. Can you confirm that >> > my attached example doesn't exhibit the problem? If it doesn't have >> > the include directory pollution problem, I'd be inclined to say it's >> > a >> > bug with the export/import functionality. >> >> Indeed, your sample project does not exhibit include path bloat. So >> this really looks like a limitation of CMake import/export mechanism >> (I say limitation, not bug, because there are simply no target >> properties detailed enough to allow this behavior). >> >> There is a property IMPORTED_LINK_DEPENDENT_LIBRARIES_ which is >> _almost_ what we want, but just for shared libraries. >> >> -- >> Ivan Shapovalov / intelfx / >> >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake > > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] dependencies between external projects (not DEPENDS)
Usually there would be variables like A_ROOT which allow the FindA.cmake module being used by B to correctly find everything. If there isn't, you'd have to write your own FindA.cmake module in either case. If you can't modify B, you could use the patch step of the external project to replace the broken FindA.cmake with your modern FindA.cmake with minimal effort while you wait for B to accept your pull request. The takeaway is, if B doesn't have a way for you to say "Look for A here first/only", that's a bug in B's FindA module. As for recursive dependencies, there is the CMakeFindDependencyMacro module, but you have to be careful about the can of worms you are opening - you'd want to only find versions which are binary compatible and also deal with cases of the wrong version of the package having already been found. Sometimes it's easier to just tell the client to find the dependencies for you, rather than trying to do it for them and potentially getting it wrong. I honestly don't know what the best approach is here. On Mon, Aug 15, 2016 at 10:56 AM, Neil Carlson wrote: > I'm struggling with how to handle dependencies between external projects in > a > superbuild. The issue is different than simply ensuring that one gets built > before > another using the DEPENDS keyword -- that's trivial. > > Suppose I have two external libraries A and B, where B depends on A. It is > not > always possible to correctly define variables like A_LIBRARIES that feed > into the > externalproject_add for B that anticipate what will come out of the A > configure/build. > There are sometimes additional link libraries that only come to light after > A is > actually configured. > > How do people handle these situations? I'm thinking of a multi-pass > approach > where one runs cmake/make twice. The first installs A skipping the > dependent B. > The second builds B (skipping a found A) using correctly set variables from > a > FindA module. > > Incidentally, is it kosher to have a Find module invoke a find_package? > There are > examples in of this in standard Find modules. This creates problems in the > superbuild context, where say A is found, but rejected by the superbuild > because > of missing features, for example, but FindB finds A and uses it. > > Thanks for your advice. > > -Neil > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Private dependencies of static libraries exported as targets
Ah, I misunderstood what you were asking about. It would be pretty weird if CMake didn't know that static libraries always need all their dependencies linked regardless of privacy, but I agree it should at least be mentioned somewhere. My bad. As for include path bloat, I cannot replicate this in my test project - CMake will link all the dependencies as required but will NOT violate "PRIVATE" for other things like include directories. Could you give an example where you are seeing a static library's private dependency's include path being added when linking the static library? On Tue, Aug 16, 2016 at 7:44 PM, Ivan Shapovalov wrote: > TBH, I do not see the "PRIVATE dependencies are made PUBLIC for the > purposes of linking when the dependent is static library" there. > > -- > Ivan Shapovalov / intelfx / > > > On 2016-08-16 at 02:35 -0500, Nicholas Braden wrote: >> Yes, the behavior is documented in several places, the most prominent >> being here: >> https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#t >> ransitive-usage-requirements >> >> >> On Mon, Aug 15, 2016 at 9:22 PM, Ivan Shapovalov > e> wrote: >> > >> > On 2016-08-15 at 21:46 -0400, Guillaume Dumont wrote: >> > > >> > > As far as I know the PRIVATE >> > > keyword >> > > should have no effect on transitive linking when foo is static >> > > and we >> > > call: >> > > >> > > target_link_libraries(foo PRIVATE bar) >> > > >> > > Hope this helps. >> > >> > Wow. I did not know that. Should've tested on sample project. >> > It does not solve include path bloat though, but that's a minor >> > issue. >> > >> > One question remains... is this behavior documented somewhere? >> > >> > Anyway, huge thanks, >> > -- >> Ivan Shapovalov / intelfx / -- 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] Private dependencies of static libraries exported as targets
Yes, the behavior is documented in several places, the most prominent being here: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#transitive-usage-requirements On Mon, Aug 15, 2016 at 9:22 PM, Ivan Shapovalov wrote: > On 2016-08-15 at 21:46 -0400, Guillaume Dumont wrote: >> As far as I know the PRIVATE >> keyword >> should have no effect on transitive linking when foo is static and we >> call: >> >> target_link_libraries(foo PRIVATE bar) >> >> Hope this helps. > > Wow. I did not know that. Should've tested on sample project. > It does not solve include path bloat though, but that's a minor issue. > > One question remains... is this behavior documented somewhere? > > Anyway, huge thanks, > -- > Ivan Shapovalov / intelfx / > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Empty libraries?
I noticed it is possible to create empty libraries like this: add_library(header-only "header.hpp") set_property(TARGET header-only PROPERTY LINKER_LANGUAGE CXX) On my machine, MinGW spits out an empty 8-byte libheader-only.a, and Visual Studio works too but outputs nothing. Is this even technically supported at all? Is this considered portable? I already know about INTERFACE library targets - however, it seems that with the above approach, the header file(s) will show up in the IDE, but not with an INTERFACE library, correct? If so, I would rather not use INTERFACE in this case as I would like the header files to show up in generated IDE 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: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] FindFreetype works with MinGW but not Visual Studio?
Ah thanks! I was looking at the master version of FindFreetype.cmake and saw that fix already there, adding to the confusion. I had changed the link in my message to the 3.6.0 tag at the last moment. Thanks for your time! Nicholas "LB" Braden On Thu, Jul 21, 2016 at 10:41 AM, Stuart Mentzer wrote: > On 7/21/2016 6:15 AM, Nicholas Braden wrote: >> >> I'm having a weird issue that is driving me crazy. I've attached a >> minimal test case - it downloads and builds Freetype 2.6.4 as static >> and then configures a project that just calls find_package(Freetype >> REQUIRED). If the attachment is not there, you can find the two text >> files here: >> https://gist.github.com/LB--/34d9dd2d9888fa4479bc9ef61183502c >> Save "my-project-CMakeLists.txt" as "CMakeLists.txt" in a "my-project" >> directory next to the other CMakeLists.txt >> >> When I build with MinGW (cmake -G "MinGW Makefiles") everything works >> smoothly and the find_package command works flawlessly. >> >> However, when I build with Visual Studio (cmake -G "Visual Studio 14 >> 2015 Win64") I get this error message: >> Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version >> "2.6.4") >> >> Looking in the install prefix, in the lib folder MinGW has a >> "libfreetype.a" and MSVC has a "freetyped.lib". Both should be >> acceptable according to the source code of the FindFreetype module: >> https://github.com/Kitware/CMake/blob/v3.6.0/Modules/FindFreetype.cmake >> >> Here are my build logs: >> MinGW: https://gist.github.com/LB--/b4f1413ba72181de7710b6f916c399f8 >> MSVC: https://gist.github.com/LB--/14a2f65dd069aa59c2a5dacd840f3535 >> >> I'm using CMake 3.6.0, MinGW-w64 GCC 6.1.0, and Visual Studio 2015 >> Update 3 - all on a Windows 10 Pro 64-bit system (build 10586.494). >> >> Does anyone know what is causing this? Why can't the find module >> discover the library archive when building with Visual Studio? >> >> For now I have been working around the issue by manually specifying >> FREETYPE_LIBRARY, which works, but is not desireable. >> >> Thanks for your time, >> Nicholas "LB" Braden >> >> > Hi Nicholas, > > I ran in to the same issue: it is due to the 'd' suffix on the debug lib > name not being handled. We've got a fixed up FindFreetype.cmake on deck for > the next release in > https://github.com/Kitware/CMake/blob/next/Modules/FindFreetype.cmake that > you can drop into your 3.6.0 installation for now. > > Stuart > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Confusion over INTERFACE vs STATIC|SHARED IMPORTED vs INTERFACE IMPORTED
There is one difference that I thought of immediately, and I tested it - an INTERFACE target can be installed/exported, but an INTERFACE IMPORTED target cannot be installed/exported because CMake considers it to not be in the build/source directory. I'm sure there are other internal differences due to the fact that imported targets aren't considered to be inside the build or source directories. I think the main takeaway is that "INTERFACE IMPORTED" is not actually a different kind of target, it is just a target which is both INTERFACE and IMPORTED. Why not allow all four combinations of INTERFACE and IMPORTED? On Tue, Jul 5, 2016 at 7:35 PM, Ted Middleton wrote: > Ack - sorry. s/INTERFACE_LINK_LIBRARIES/IMPORTED_LOCATION/cg. > INTERFACE_LINK_LIBRARIES I guess would be a completely valid property to set > on an add_library(foo INTERFACE) target. But IMPORTED_LOCATION wouldn't, > right? > > "INTERFACE IMPORTED would then mean there is no compiled > binary to be linked against, just as INTERFACE alone means there are > no sources to create said binary from" > > Is there a difference between them, then? If neither produce an actual build > rule, and neither can point to a .lib/.so/.dll/.a/.dylib, are they not > exactly the same thing? The documentation says that add_library(foo > INTERFACE IMPORTED) creates an /imported target/, but the explanation of > what exactly this is is ... confusing? Based on the description of what an > /imported target/ is, I would think that it is the same thing that > add_library(foo IMPORTED) produces? > > > > On Tue, Jul 5, 2016 at 4:09 PM, Nicholas Braden > wrote: >> >> From what I understand, interface libraries just don't have sources or >> build results. INTERFACE IMPORTED would then mean there is no compiled >> binary to be linked against, just as INTERFACE alone means there are >> no sources to create said binary from. At least, that is my >> understanding. >> >> > My understanding of this is that setting INTERFACE_LINK_LIBRARIES on a >> > target like this would be an error? >> >> Why can't a header-only library link to non-header-only libraries? >> >> On Tue, Jul 5, 2016 at 5:17 PM, Ted Middleton >> wrote: >> > I'm looking at the documentation for add_library(), and I'm really >> > confused >> > about the distinction between add_library(foo INTERFACE) vs >> > add_library(foo >> > INTERFACE IMPORTED) vs add_library(foo IMPORTED). >> > >> > Correct me if I'm wrong (and I probably am), but add_library(foo >> > INTERFACE) >> > is for propagating properties like INTERFACE_INCLUDE_DIRECTORIES to >> > other >> > targets using target_link_libraries(), so that header-only libraries can >> > be >> > consumed by other targets conveniently. My understanding of this is that >> > setting INTERFACE_LINK_LIBRARIES on a target like this would be an >> > error? >> > >> > And add_library(foo SHARED IMPORTED) would be to create a target object >> > for >> > a pre-existing library (like a platform lib or something) for which >> > cmake is >> > not supposed to try to create an actual "call the compiler and >> > linkeditor or >> > archiver" build rule. This still boils down to mostly propagating >> > properties, no? Except now some of those properties can be things like >> > INTERFACE_LINK_LIBRARIES? >> > >> > So can anyone tell me what add_library(foo INTERFACE IMPORTED) is? The >> > documentation says, >> > >> > "An INTERFACE Imported Target may also be created with this signature. >> > An >> > IMPORTED library target references a library defined outside the >> > project. >> > The target name has scope in the directory in which it is created and >> > below, >> > but the GLOBAL option extends visibility. It may be referenced like any >> > target built within the project. IMPORTED libraries are useful for >> > convenient reference from commands like target_link_libraries()." >> > >> > That description is what I thought add_library(foo >> > IMPORTED) >> > was for? >> > >> > >> > >> > -- >> > >> > 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: >> >
Re: [CMake] Confusion over INTERFACE vs STATIC|SHARED IMPORTED vs INTERFACE IMPORTED
>From what I understand, interface libraries just don't have sources or build results. INTERFACE IMPORTED would then mean there is no compiled binary to be linked against, just as INTERFACE alone means there are no sources to create said binary from. At least, that is my understanding. > My understanding of this is that setting INTERFACE_LINK_LIBRARIES on a target > like this would be an error? Why can't a header-only library link to non-header-only libraries? On Tue, Jul 5, 2016 at 5:17 PM, Ted Middleton wrote: > I'm looking at the documentation for add_library(), and I'm really confused > about the distinction between add_library(foo INTERFACE) vs add_library(foo > INTERFACE IMPORTED) vs add_library(foo IMPORTED). > > Correct me if I'm wrong (and I probably am), but add_library(foo INTERFACE) > is for propagating properties like INTERFACE_INCLUDE_DIRECTORIES to other > targets using target_link_libraries(), so that header-only libraries can be > consumed by other targets conveniently. My understanding of this is that > setting INTERFACE_LINK_LIBRARIES on a target like this would be an error? > > And add_library(foo SHARED IMPORTED) would be to create a target object for > a pre-existing library (like a platform lib or something) for which cmake is > not supposed to try to create an actual "call the compiler and linkeditor or > archiver" build rule. This still boils down to mostly propagating > properties, no? Except now some of those properties can be things like > INTERFACE_LINK_LIBRARIES? > > So can anyone tell me what add_library(foo INTERFACE IMPORTED) is? The > documentation says, > > "An INTERFACE Imported Target may also be created with this signature. An > IMPORTED library target references a library defined outside the project. > The target name has scope in the directory in which it is created and below, > but the GLOBAL option extends visibility. It may be referenced like any > target built within the project. IMPORTED libraries are useful for > convenient reference from commands like target_link_libraries()." > > That description is what I thought add_library(foo IMPORTED) > was for? > > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] How do you handle recursive dependencies in CMake
If find_project is not enough, and ExternalProject's only problem is build duplication, then I think it makes sense to consider a CMake-based dependency manager such as hunter: https://github.com/ruslo/hunter On Thu, Jun 30, 2016 at 3:59 AM, Sven Baars wrote: > This is a reply to the options that Ray gave. Here I will use the > package dependencies C -> B -> A{1,2}: > > 1) The "ad-hoc" method I first mentioned by setting > CMAKE_LIBRARY_OUTPUT_DIRECTORY. > > As far as I understand, this would mean that every user of all of the > different projects would have to be forced to use this, and would not be > allowed to "install" anything anywhere else, which doesn't seem nice. > > 2) ExternalProject which will grab a repository and build it. > > This will not work. One of the projects I use is Trilinos, which has > build of around 1GB. I don't want to pull and build that for every > project I have. Also the build flags that are used sometimes differ per > machine, not per project, so it would be nice if I could build it only > once per machine. > > Also, in a more generalized sense, this would also mean that every > project I pull with ExtenalProject should also pull its own dependencies > with ExternalProject. So then if every project on my system used CMake, > this would mean that I would recursively rebuild my entire system for > every project I have. This doesn't seem right. > > 3) Some Find_Package () mechanism that will do a search for it. > > The point I had is that we actually try to use this. However, the > find_package does not find all dependencies. And we don't know in > package C whether it depends on A1 or A2, because of build flags/CMake > checks that were used for project B. So we can't just do a find_package > for either A1 or A2, because we don't know which one was used unless we > perform all the CMake checks that were done in project B (in some cases > 10k+ lines of CMake code). > > 4) Your option of including *.cmake files that provide the paths > [sorry, I might have misunderstood it]. > > This, so far, is the only option, because then B can tell us that it > used A2, not A1. This can just be done by providing absolute paths to > the libraries that were used in the compilation of B. But we are looking > for a standardized way to do this. I'd prefer to not have a lot of > custom code in all of my libraries. > > Now some more information: > > On supercomputers it is very common that every library on the system is > installed in a different directory. This is so every user can load their > own version of the library without breaking the system for others. > Therefore, you will never find libraries that are installed in the > standard system directories where CMake looks for the libraries. By > using PATH you can make it able to find the place where to look for the > FoobarConfig.cmake files, which is great when you want to build project > B, and this is also done automatically on all supercomputers I work on, > but those config files do not contain information on where the actual > libraries of project A are when you build project C. I guess Cfyz and me > think they should in some standardized way. > > Sven > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Compiling binaries with cmake -- help
Yep, if you have all the dependencies it should just work as I described in a previous message. On Thu, Jun 23, 2016 at 12:20 AM, Crest Christopher wrote: > I'll get the Python sipconfig module installed, then I hope we can continue > with getting it compiled ? > > Nicholas Braden > Thursday, June 23, 2016 1:15 AM > Yes, many projects do not include their dependencies and require you > to obtain them yourself. In this case it looks like you need the > Python sipconfig module installed. > > On Thu, Jun 23, 2016 at 12:10 AM, Crest Christopher > Nicholas Braden > Thursday, June 23, 2016 1:08 AM > It looks like the instructions are there in the README. I tried > building on my system but I'm missing some dependencies (e.g. at some > point it finds my Python 3 installation and tries to run some code but > fails due to a missing sipconfig module, which I am not familiar > with). > > Generally, to build a project that uses CMake, create an empty > directory for the build and open a terminal in it, then run CMake with > the path to the directory containing CMakeLists.txt and optionally > specify the generator to use if the default is not the one you want. > Then, if it completes without errors, you can use "cmake --build ." to > build it and "cmake --build . --target install" to install it, even if > you used an IDE generator. > > As for the project dependencies, you are own your own to get those. > > On Wed, Jun 22, 2016 at 11:56 PM, Crest Christopher > Martin Maurer > Thursday, June 23, 2016 12:45 AM > Hello, > > how about to share the github URL, > which file you have downloaded or project you want to compile? > > I think this would make it much easier for readers to help. > > Best regards, > > Martin > > Nicholas Braden > Wednesday, June 22, 2016 8:50 PM > Are you trying to use an existing CMakeLists.txt, or are you trying to > create your own? CMake doesn't just work on source files alone. > > On Wed, Jun 22, 2016 at 7:30 PM, Crest Christopher > Crest Christopher > Wednesday, June 22, 2016 8:30 PM > Hi, I'm hoping I can get some help on how to compile a repository from > github which is local on my machine with a series of folders which contain > CPP extension files. > > I have chosen the folders for which most likely contain the correct files to > compile the binaries followed by the folder to which to build the binaries > then I have chosen generate but I'm getting an error that the project files > are invalid ? > > -- 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] CXX_STANDARD and -std=c++14
This was asked recently - have a look at the CXX_EXTENSIONS property: https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html Previous discussion: http://public.kitware.com/pipermail/cmake/2016-June/063691.html On Thu, Jun 23, 2016 at 7:27 AM, James Swift wrote: > Hi, > > is there a way (or can it be added) to get set_property(TARGET target > PROPERTY CXX_STANDARD 14) to output -std=c++14 and not -std=gnu++14 when > needed? > > Thanks, > James Swift > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Compiling binaries with cmake -- help
Yes, many projects do not include their dependencies and require you to obtain them yourself. In this case it looks like you need the Python sipconfig module installed. On Thu, Jun 23, 2016 at 12:10 AM, Crest Christopher wrote: > It can work, but it's missing dependencies ? > > Nicholas Braden > Thursday, June 23, 2016 1:08 AM > It looks like the instructions are there in the README. I tried > building on my system but I'm missing some dependencies (e.g. at some > point it finds my Python 3 installation and tries to run some code but > fails due to a missing sipconfig module, which I am not familiar > with). > > Generally, to build a project that uses CMake, create an empty > directory for the build and open a terminal in it, then run CMake with > the path to the directory containing CMakeLists.txt and optionally > specify the generator to use if the default is not the one you want. > Then, if it completes without errors, you can use "cmake --build ." to > build it and "cmake --build . --target install" to install it, even if > you used an IDE generator. > > As for the project dependencies, you are own your own to get those. > > On Wed, Jun 22, 2016 at 11:56 PM, Crest Christopher > Martin Maurer > Thursday, June 23, 2016 12:45 AM > Hello, > > how about to share the github URL, > which file you have downloaded or project you want to compile? > > I think this would make it much easier for readers to help. > > Best regards, > > Martin > > Nicholas Braden > Wednesday, June 22, 2016 8:50 PM > Are you trying to use an existing CMakeLists.txt, or are you trying to > create your own? CMake doesn't just work on source files alone. > > On Wed, Jun 22, 2016 at 7:30 PM, Crest Christopher > Crest Christopher > Wednesday, June 22, 2016 8:30 PM > Hi, I'm hoping I can get some help on how to compile a repository from > github which is local on my machine with a series of folders which contain > CPP extension files. > > I have chosen the folders for which most likely contain the correct files to > compile the binaries followed by the folder to which to build the binaries > then I have chosen generate but I'm getting an error that the project files > are invalid ? > > -- 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] Compiling binaries with cmake -- help
It looks like the instructions are there in the README. I tried building on my system but I'm missing some dependencies (e.g. at some point it finds my Python 3 installation and tries to run some code but fails due to a missing sipconfig module, which I am not familiar with). Generally, to build a project that uses CMake, create an empty directory for the build and open a terminal in it, then run CMake with the path to the directory containing CMakeLists.txt and optionally specify the generator to use if the default is not the one you want. Then, if it completes without errors, you can use "cmake --build ." to build it and "cmake --build . --target install" to install it, even if you used an IDE generator. As for the project dependencies, you are own your own to get those. On Wed, Jun 22, 2016 at 11:56 PM, Crest Christopher wrote: > Hi, here is the github URL; I hope it will help, to help me understand how > to compile and use should I come across a cMaker compiler installation in > the future. > > Martin Maurer > Thursday, June 23, 2016 12:45 AM > Hello, > > how about to share the github URL, > which file you have downloaded or project you want to compile? > > I think this would make it much easier for readers to help. > > Best regards, > > Martin > > Nicholas Braden > Wednesday, June 22, 2016 8:50 PM > Are you trying to use an existing CMakeLists.txt, or are you trying to > create your own? CMake doesn't just work on source files alone. > > On Wed, Jun 22, 2016 at 7:30 PM, Crest Christopher > Crest Christopher > Wednesday, June 22, 2016 8:30 PM > Hi, I'm hoping I can get some help on how to compile a repository from > github which is local on my machine with a series of folders which contain > CPP extension files. > > I have chosen the folders for which most likely contain the correct files to > compile the binaries followed by the folder to which to build the binaries > then I have chosen generate but I'm getting an error that the project files > are invalid ? > > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Compiling binaries with cmake -- help
Are you trying to use an existing CMakeLists.txt, or are you trying to create your own? CMake doesn't just work on source files alone. On Wed, Jun 22, 2016 at 7:30 PM, Crest Christopher wrote: > Hi, I'm hoping I can get some help on how to compile a repository from > github which is local on my machine with a series of folders which contain > CPP extension files. > > I have chosen the folders for which most likely contain the correct files to > compile the binaries followed by the folder to which to build the binaries > then I have chosen generate but I'm getting an error that the project files > are invalid ? > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Dependency on imported target with ninja-generator
If Project B depends on Project A, you should probably be using the ExternalProject module with a superproject structure that builds both projects in the proper order. https://cmake.org/cmake/help/latest/module/ExternalProject.html Trying to manually call CMake is not really a good idea IMO - let ExternalProject handle it for you. On Wed, Jun 22, 2016 at 10:59 AM, Patrick Boettcher wrote: > Hi list, > > I'm finding myself in the following situation. > > - Project A generates libmain.a and export(TARGETS ... NAMESPACE ns) it > to a file. The target is called ns::main > > - Project B includes this file and has some executables link with > libmain.a (via target_link_libraries(exe ns::main). > > - Project B's CMakeLists.txt contains a add_custom_target(build ...) > which runs cmake --build in project A's build-dir. > > - the target build is a add_dependency() of ns::main. > > Building it with gnu-make works like a charm - make is entering project > A's build-dir before linking. > > Building it with ninja fails with not finding libmain.a - which is > normal it has not yet been built. Ninja seems to evaluate the complete > dependency-tree of files before doing anything. > > Is there a way to fix this? > > Thanks. > > best regards, > -- > Patrick. > > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Policy CMP0063 is not set: Honor visibility properties for all target
CMP0063 was not added until CMake 3.3, so requesting 3.1 as the minimum does not make sense. https://cmake.org/cmake/help/latest/policy/CMP0063.html On Sat, Jun 18, 2016 at 6:03 AM, Alexander Shukaev wrote: > On 06/18/2016 12:18 PM, Nils Gladitz wrote: >> >> On 18.06.2016 11:38, Alexander Shukaev wrote: >>> >>> >>> I did try both variants, after and before >>> >>> cmake_minimum_required(VERSION) >>> >>> but the result is the same. The scope is for sure parent to targets. >> >> >> I don't know what else it could be but this works fine for me: >> >>cmake_minimum_required(VERSION 2.8.12) >> >>if(POLICY CMP0063) >> cmake_policy(SET CMP0063 NEW) >>endif() >> >>file(WRITE foo.cpp "int main() {}") >> >>set(CMAKE_CXX_VISIBILITY_PRESET hidden) >> >>add_executable(foo foo.cpp) >> >> >> Is it possible that the scope where the policy warning comes from has >> its own cmake_minimum_required(VERSION) call? (e.g. is there more than >> one?) >> >> Nils >> > > You were right, Nils. I have a CMake library that is pretty huge. When one > does `find_package' for it, then it will `include' all its modules into the > client code. Back when I started it, I didn't know that > `cmake_minimum_required' can reset policies. So there were a couple of > modules that were still calling `cmake_minimum_required' which is clearly a > bad practice. I cleaned it up and it works now. > > However, now the sequence is like this > > xxx.cmake: > > if(POLICY CMP0011) > cmake_policy(SET CMP0011 NEW) > endif() > if(POLICY CMP0063) > cmake_policy(SET CMP0063 NEW) > endif() > > CMakeLists.txt: > > include(xxx) > cmake_minimum_required(VERSION 3.1.0) > > and it still works. Is it because the version is high enough so it does not > reset policies? > > Alexander > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Calling find_package(self) for in-project builds
Although not ideal, you could alias the targets to the names they would have when imported with find_package() by using add_library(ALIAS), and then use if(TARGET) to conditionally call find_package(). This also is a step toward supporting using the library via add_subdirectory(), if that ever becomes a goal. On Thu, Jun 2, 2016 at 8:06 PM, Walter Gray wrote: > I'm currently working on protobuf-3.0.0's cmake scripts, and I've hit a bit > of a chicken and egg problem. > > There is an examples directory containing a CMakeLists.txt which we would > like to work as both a standalone examples directory and include as a sub > directory of the full build. For obvious reasons, the CMakeLists.txt file > contains a call to find_package(protobuf). > > I can call find_package(protobuf HINTS ${CMAKE_BINARY_DIR}) outside of the > examples/CMakeLists.txt file to ensure that we've already found the correct > version, but the problem is that the protobuf-config.cmake file includes the > export-generated file protobuf-targets.cmake, as well as implementing some > custom functions that we want to show off as part of the examples. > > The obvious solution to me was to use the export command to generate > protobuf-targets.cmake, but there are 2 problems. First, export(EXPORT) > doesn't create a file until generation time, but I can get around this using > export(TARGETS). The second is that, reading CMP0024, this appears to be not > garunted behavior, and actively discouraged. > > What would be the suggested way to handle this? > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] How to use CMAKE_MFC_FLAG for only one on executables?
Have you tried unsetting it after adding the executable in question? If that doesn't work, is it possible to make the MFX executable be the very last executable added in your project? On Wed, Jun 1, 2016 at 4:50 AM, Zhang Peixuan wrote: > Hello All, > > I want to use CMake to manage my MFC projects, and I added the following > code: > > set( CMAKE_MFC_FLAG 2) > add_executable(MFCDemo WIN32 > ${MFC_RESOURCE_FILES} > ${MFC_HEADER_FILES} > ${MFC_SOURCE_FILES} > ) > target_compile_definitions(MFCDemo > PUBLIC -D_AFXDLL=1 > PUBLIC -D_UNICODE > PUBLIC -DUNICODE > ) > > It works. > However, my question is that: In addition to the MFC executable, I still > have some non-MFC executables, > and once CMAKE_MFC_FLAG is set, all the add_executables' property should be > "Use MFC in a Shared DLL". > In fact, I want only one MFC executable, and make sure all other executables > are "Use Standard Windows Library". > Is there any way to implement it? It seems CMAKE_MFC_FLAG does not work with > set_target_property or other commands. > > Thanks, > Peixuan Zhang > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Unknown CMake command "macro_ensure_version"
I found several different versions of basically the same code in many projects, but it looks like openbabel is what you are trying to compile: https://github.com/baoilleach/openbabel-svn-mirror/blob/master/cmake/modules/MacroEnsureVersion.cmake Do you have this file in /cmake/modules/ ? It looks like that directory is being properly added to CMAKE_MODULE_PATH here: https://github.com/baoilleach/openbabel-svn-mirror/blob/master/CMakeLists.txt#L6-L7 Can you verify that you have those lines in the CMakeLists.txt you have downloaded? On Sun, May 1, 2016 at 4:30 AM, Douglas Houston wrote: > Hi, > > I am trying to use Cmake to compile a program on Scientific Linux release > 6.7, and I get the following error with both the precompiled binary and my > own compiled version of Cmake: > > > > [root@drhwks]# ~/cmake-3.5.2-Linux-x86_64/bin/cmake ~/openbabel-2.3.2 > CMake Error at CMakeLists.txt:20 (include): > include could not find load file: > > MacroEnsureVersion > > > -- Using included inchi library. > -- Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES > wxWidgets_INCLUDE_DI > RS) > CMake Error at CMakeLists.txt:231 (macro_ensure_version): > Unknown CMake command "macro_ensure_version". > > > -- Configuring incomplete, errors occurred! > See also "/root/openbabel-2.3.2/build/CMakeFiles/CMakeOutput.log". > See also "/root/openbabel-2.3.2/build/CMakeFiles/CMakeError.log". > [root@drhwks build]# ls -lht | head > total 24K > -rw-r--r--. 1 root root 17K May 1 10:13 CMakeCache.txt > drwxr-xr-x. 5 root root 4.0K Apr 30 09:09 CMakeFiles > [root@drhwks build]# rm CMake > CMakeCache.txt CMakeFiles/ > [root@drhwks build]# rm -rf CMake* > [root@drhwks build]# ~/cmake-3.5.2-Linux-x86_64/bin/cmake ~/openbabel-2.3.2 > -- The C compiler identification is GNU 4.4.7 > -- The CXX compiler identification is GNU 4.4.7 > -- 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 > -- Check for working CXX compiler: /usr/bin/c++ > -- Check for working CXX compiler: /usr/bin/c++ -- works > -- Detecting CXX compiler ABI info > -- Detecting CXX compiler ABI info - done > -- Detecting CXX compile features > -- Detecting CXX compile features - done > CMake Error at CMakeLists.txt:20 (include): > include could not find load file: > > MacroEnsureVersion > > > -- Using included inchi library. > -- Found LibXml2: /usr/lib64/libxml2.so (found version "2.7.6") > -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3") > -- Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES > wxWidgets_INCLUDE_DI > RS) > -- Looking for conio.h > -- Looking for conio.h - not found > -- Looking for sys/time.h > -- Looking for sys/time.h - found > -- Looking for time.h > -- Looking for time.h - found > -- Looking for strings.h > -- Looking for strings.h - found > -- Looking for rpc/xdr.h > -- Looking for rpc/xdr.h - found > -- Looking for regex.h > -- Looking for regex.h - found > -- Looking for C++ include sstream > -- Looking for C++ include sstream - found > -- Looking for rint > -- Looking for rint - not found > -- Looking for snprintf > -- Looking for snprintf - found > -- Looking for sranddev > -- Looking for sranddev - not found > -- Looking for strcasecmp > -- Looking for strcasecmp - found > -- Looking for strncasecmp > -- Looking for strncasecmp - found > -- Looking for dlopen in dl > -- Looking for dlopen in dl - found > -- Looking for sys/types.h > -- Looking for sys/types.h - found > -- Looking for stdint.h > -- Looking for stdint.h - found > -- Looking for stddef.h > -- Looking for stddef.h - found > -- Check size of clock_t > -- Check size of clock_t - done > CMake Error at CMakeLists.txt:231 (macro_ensure_version): > Unknown CMake command "macro_ensure_version". > > > -- Configuring incomplete, errors occurred! > See also "/root/openbabel-2.3.2/build/CMakeFiles/CMakeOutput.log". > See also "/root/openbabel-2.3.2/build/CMakeFiles/CMakeError.log". > > > > Can anyone please help? > > Regards, > Douglas Houston > > > > -- > The University of Edinburgh is a charitable body, registered in > Scotland, with registration number SC005336. > > > -- > > 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-
Re: [CMake] c++11 feature and cmake feature name mapping
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 -- 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] find_package: request/proposal for better version matching support
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
Re: [CMake] Firefox and chrome warnings when dowloading cmake windows installers
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 -- 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] Include XYZ.cmake from external project
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_REPOSITORYhttps://simunova.zih.tu-dresden.de/svn/mtl4/trunk > SVN_USERNAME guest > SVN_PASSWORD guest > SVN_TRUST_CERT1 > 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
Re: [CMake] How to deal with generated source files (w/ dependency tracking) for globs
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
Re: [CMake] How to deal with generated source files (w/ dependency tracking) for globs
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 -- 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] Mixing up project language settings?
If the new C++ components are built optionally, I would use enable_language(CXX): https://cmake.org/cmake/help/latest/command/enable_language.html Otherwise, if the project will always need C++ support from now on, amend the project() statement. In this case it doesn't matter whether you add CXX or remove C, it is up to you aesthetically. On Thu, Mar 31, 2016 at 2:38 PM, Fedja Jeleskovic wrote: > Hi there! > > I am adding few components to the existing cmake driven C project, but new > components need C++ compiler instead. Top level CMakeLists.text starts with: > project (appName C) > > The question is whether I need to change to top level settings and just > include CXX (or just remove C part since they are both defaulted anyway) > where my new components are, or the top level needs to be changed as well to > reflects what will be used below. > > Thanks! > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Two phase install?
Sure, here are a couple of my own projects: https://github.com/LB--/events/blob/e3215d84644c67848b6d716d308e66c6f186b84e/CMakeLists.txt#L26-L29 https://github.com/LB--/simple-platformer/blob/5b8541354109137798d648bc9d8fe164137de9ab/CMakeLists.txt#L63-L67 On Wed, Mar 23, 2016 at 8:11 PM, Scott Aron Bloom wrote: > Ok.. Do you have an example somewhere ? > > -Original Message- > From: Nicholas Braden [mailto:nicholas11bra...@gmail.com] > Sent: Wednesday, March 23, 2016 6:11 PM > To: Scott Aron Bloom > Cc: Alan W. Irwin; cmake@cmake.org > Subject: Re: [CMake] Two phase install? > > Both projects should be built via ExternalProject within a superproject, this > way you can use the DEPENDS arguments to guarantee build order. > > On Wed, Mar 23, 2016 at 8:08 PM, Scott Aron Bloom wrote: >> Do you have apointer to an example of using the external_project. >> >> I have split the projects up, and install the first one.. But I cant >> seem to get the external project on the downstream cmake run to >> properly depend that the previous one was run >> >> Scott >> >> -Original Message- >> From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Scott Aron >> Bloom >> Sent: Wednesday, March 23, 2016 2:50 PM >> To: Alan W. Irwin >> Cc: cmake@cmake.org >> Subject: Re: [CMake] Two phase install? >> >> -Original Message- >> From: Alan W. Irwin [mailto:ir...@beluga.phys.uvic.ca] >> Sent: Wednesday, March 23, 2016 2:48 PM >> To: Scott Aron Bloom >> Cc: cmake@cmake.org >> Subject: Re: [CMake] Two phase install? >> >> On 2016-03-23 20:25- Scott Aron Bloom wrote: >> >>> Here is my problem. >>> >>> The project I have creates an application, that is needed to build the rest >>> of the project. >>> >>> To imagine it, imagine the application is a custom yacc/lex based parser >>> that reads in a file and generates an output file. >>> >>> In order for the application to run correctly, it needs an install step. >>> However, the results of the application, are part of the final install. >>> >>> Is there anyway to say "build this, and create its install area" and >>> afterwards run the rest of the requirements for install? >> >> Yes. I suggest you build and install your application and the rest of your >> project as two separate CMake projects with a common install-tree prefix. >> >> Of course, you could stop there with two completely independent projects >> that you (and your users) learn to build and install in the correct order. >> However, CMake allows you to organize such multiple builds and installs with >> ExternalProject_Add. I like and use that a lot for large numbers of >> different projects that depend on each other, and you might also find it >> useful for your case of just two independent projects. >> >> Alan >> >> >> Thanks, the ExternalProject_Add is exactly what I needed a hint towards!!! >> >> >> >> -- >> >> 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
Re: [CMake] Two phase install?
Both projects should be built via ExternalProject within a superproject, this way you can use the DEPENDS arguments to guarantee build order. On Wed, Mar 23, 2016 at 8:08 PM, Scott Aron Bloom wrote: > Do you have apointer to an example of using the external_project. > > I have split the projects up, and install the first one.. But I cant seem to > get the external project on the downstream cmake run to properly depend that > the previous one was run > > Scott > > -Original Message- > From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Scott Aron Bloom > Sent: Wednesday, March 23, 2016 2:50 PM > To: Alan W. Irwin > Cc: cmake@cmake.org > Subject: Re: [CMake] Two phase install? > > -Original Message- > From: Alan W. Irwin [mailto:ir...@beluga.phys.uvic.ca] > Sent: Wednesday, March 23, 2016 2:48 PM > To: Scott Aron Bloom > Cc: cmake@cmake.org > Subject: Re: [CMake] Two phase install? > > On 2016-03-23 20:25- Scott Aron Bloom wrote: > >> Here is my problem. >> >> The project I have creates an application, that is needed to build the rest >> of the project. >> >> To imagine it, imagine the application is a custom yacc/lex based parser >> that reads in a file and generates an output file. >> >> In order for the application to run correctly, it needs an install step. >> However, the results of the application, are part of the final install. >> >> Is there anyway to say "build this, and create its install area" and >> afterwards run the rest of the requirements for install? > > Yes. I suggest you build and install your application and the rest of your > project as two separate CMake projects with a common install-tree prefix. > > Of course, you could stop there with two completely independent projects that > you (and your users) learn to build and install in the correct order. > However, CMake allows you to organize such multiple builds and installs with > ExternalProject_Add. I like and use that a lot for large numbers of > different projects that depend on each other, and you might also find it > useful for your case of just two independent projects. > > Alan > > > Thanks, the ExternalProject_Add is exactly what I needed a hint towards!!! > > > > -- > > 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
Re: [CMake] why no cumulative variable operations via the commandline?
Ah, I understand now - I have a habit of forgetting that you can configure existing CMake builds by repeatedly invoking cmake. I don't know if such a feature exists but it definitely sounds useful. On Sat, Mar 19, 2016 at 12:03 PM, René J. V. wrote: > Nicholas Braden wrote: > > >> sense. Could you give an example of when you would find them useful? I >> think maybe I am not understanding what you want. > > Yeah, I realise my explanation may not have been very clear. > >> If you just want to pass a list of values to a variable on the command >> line, separate the values with semicolons: >> cmake "-DMY_LIST=example value 1;example value 2" > > > Now take an example where you are in fact assembling the commandline in > subsequent steps. A good example would be a build system like MacPorts that > uses > a kind of header files (so-called PortGroups) that can be included by the > build > scripts for packages of dependent software (say, the Kate5 editor). There's a > PortGroup for cmake itself, and there's a PortGroup for Qt5 and one for the > KF5 > frameworks. Each of those PortGroups can provide an element for MY_LIST (think > of the module path, or preprocessor tokens), but evidently they cannot make > assumptions about the contents of the variable. > > In other words, it would make sense for certain types of programmatically > generated commandlines to do things like > > cmake -DMY_LIST+=val1 -DMY_LIST+=val3 -DMY_LIST+=val2 > > At the moment we can do this reliably by using our own registers, one for each > CMake variable that might be used this way, splicing them into the commandline > just before invoking cmake. Not impossible, but somewhat of a hassle and a > pity > for a feature that seems useful and probablye rather trivial to implement. > > CMake commandline can get quite long, so this might even make sense as a > convenience for composing one manually. > > Of course it would be convenient to have a concatenation operator in the cmake > language too ;) > > 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 -- 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] why no cumulative variable operations via the commandline?
The command line is the first point where variables can be defined (all code runs after this), so I am not sure where you expect pre-existing values to come from in order for a += or -= to make sense. Could you give an example of when you would find them useful? I think maybe I am not understanding what you want. If you just want to pass a list of values to a variable on the command line, separate the values with semicolons: cmake "-DMY_LIST=example value 1;example value 2" On Sat, Mar 19, 2016 at 4:52 AM, René J. V. wrote: > Hi, > > I've been wondering about something that is a real stumbling block in a > build/distribution system like MacPorts where settings can be modified in any > number of consecutive steps. For instance, depending on what dependencies a > package ("port") requires and how those dependencies are installed, elements > may > be added to the module search path repeatedly. > > In cmake language one does cumulative operations like that explicitly, but I'm > not aware of any way to do that on the command line. > > Is there a reason why one cannot do something like > > cmake -DCMAKE_FOO+=bar > > or > > CMAKE -ACMAKE_FOO=bar (-A for add instead of define) > > (or -DCMAKE_FOO-=bar, for that matter...) ? > > Thanks, > René > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] ExternalProject and libraries again
I'm not sure which discussion you're referring to, so forgive me if this was already mentioned - but are you using a superproject to ensure that dependencies are built and installed before your own project? That is, all dependencies as well as your own project are built via ExternalProject_Add and you use the DEPENDS option to ensure build order. This is generally the easiest way to do things, in my experience. On Wed, Mar 9, 2016 at 3:22 PM, Bruce Stephens wrote: > (This is really a continuation of a discussion from 25/26 January.) > > I'm still confused about ExternalProject_Add and libraries. > > I'd like to get to the point where I (or more likely a process > somewhere) can check out a project, then run cmake and ninja (or make > or whatever) and have that build the project and its dependencies. > > Concretely, suppose I have a trivial project that uses libcrypto from > OpenSSL and I have a local repository with OpenSSL with some patches > to build it with cmake. > > One suggestion is that I can use ExternalProject_Add to download and > build this openssl which can then export a FindOpenSSL.cmake script. > But that happens too late, doesn't it? > > When I run cmake on my project it can't use find_library and things to > find the right library files since those won't exist until I actually > build the project? > > Hence hunter's approach of downloading and building projects during > the cmake process, I imagine. Which feels a bit icky, but maybe it's > really the most straightforward way to do it? > > I think I might resort to some trickery: build the various dependent > things on the platforms I care about, and then have my main project > just know about where the interesting targets are relative to > BINARY_DIR for each of the external projects. (Or use the approach of > hunter, or use some build script.) > > Am I missing something obvious? It feels like I must be somehow. > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Create main and sub-projects; be able to compile them together and individually.
Yep, just make each project act independently with no knowledge of the superproject, and have the superproject glue it all together as a convenience for the user if they don't want to manually build things separately or if they don't have existing installs. That's what I am doing with my projects. On Tue, Mar 8, 2016 at 7:17 PM, Muhammad Osama wrote: > Wow, this is powerful! Question; Will I be able to compile the sub-project > individually? > Because as I see this is what we will use in the root/CMakeLists.txt, but > what about the sub-dirs which I really want to be "independent" if the user > wants. > > On Tue, Mar 8, 2016 at 5:13 PM, Nicholas Braden < > nicholas11bra...@gmail.com> wrote: > >> Example simple usages from my personal projects: >> >> https://github.com/LB--/events/blob/499ba78b923b40f77cc832b6a5d414240209ac96/CMakeLists.txt >> >> https://github.com/LB--/simple-platformer/blob/1bba3dd2d8ed1cdae74ce1b77c4ab99878fa59a6/CMakeLists.txt >> >> More complex usage in hunter: >> https://github.com/ruslo/hunter >> >> With ExternalProject you can have it either download from version control >> / source archive, or you can use a local existing folder. I think in your >> case you just need to point it to your existing project folders and forward >> the appropriate arguments. There is a lot of customizability to it >> (customizing each step, for example). If you want I could make an example >> exactly like your provided example directory structure, but I think both of >> my personal usages closely match what you are wanting to do. >> >> On Tue, Mar 8, 2016 at 7:02 PM, Muhammad Osama wrote: >> >>> Thank you for your suggestion Nicholas, I have never used >>> ExternalProject_Add before and can't find a related example to my project. >>> Would you know an example that uses it? >>> >>> On Tue, Mar 8, 2016 at 10:38 AM, Nicholas Braden < >>> nicholas11bra...@gmail.com> wrote: >>> >>>> Have you looked into ExternalProject_Add? It allows just using a local >>>> path instead of downloading a remote repository: >>>> >>>> https://cmake.org/cmake/help/latest/module/ExternalProject.html >>>> >>>> On Tue, Mar 8, 2016 at 12:12 PM, Muhammad Osama >>>> wrote: >>>> >>>>> Hi Jan, >>>>> >>>>> Thank you for your reply, I am in the similar situation, have a very >>>>> similar implementation using *target_*** *but since I don't do that >>>>> for ALL the dependencies, I am unable to cmake or compile individual >>>>> projects in the sub directories. So, few questions; >>>>> >>>>> 1. This still requires me to run cmake on the root CMakeLists.txt to >>>>> set the flags and what not before I run the sub project to make it >>>>> correct? >>>>> 1a. If so, how can I make the CMakeLists.txts in the sub directories >>>>> independent of the root one if I want to just compile the sub-project and >>>>> not cmake the whole thing? >>>>> 2. Another question is that your implementation, does it not include a >>>>> config file? In theory you're copy pasting most of the dependencies in the >>>>> CMakeLists.txt of root into the sub-dir ones? Is there a better way to do >>>>> this? >>>>> >>>>> Thank you! >>>>> >>>>> On Tue, Mar 8, 2016 at 2:02 AM, 🐋 Jan Hegewald >>>>> wrote: >>>>> >>>>>> Hi Muhammad, >>>>>> >>>>>> > On 08.03.2016, at 06:17, Muhammad Osama wrote: >>>>>> > >>>>>> > Hi, I am new to cmake and really hope am doing this correctly. I >>>>>> asked stackoverflow but didn't get a good enough answer for my specific >>>>>> problem here; >>>>>> > >>>>>> > If I want root/sub-directories/ as separate sub-projects that can >>>>>> be compiled using the individualCMakeLists.txts in their folders I find >>>>>> myself literally copy pasting almost the entire root file CMakeLists.txt >>>>>> per sub-directory. >>>>>> > >>>>>> > I was wondering if there is a better way to have a main project and >>>>>> then sub-projects that get the shared dependencies from main project and >>>>>> can be compiled without cmake-ing the root
Re: [CMake] Create main and sub-projects; be able to compile them together and individually.
Example simple usages from my personal projects: https://github.com/LB--/events/blob/499ba78b923b40f77cc832b6a5d414240209ac96/CMakeLists.txt https://github.com/LB--/simple-platformer/blob/1bba3dd2d8ed1cdae74ce1b77c4ab99878fa59a6/CMakeLists.txt More complex usage in hunter: https://github.com/ruslo/hunter With ExternalProject you can have it either download from version control / source archive, or you can use a local existing folder. I think in your case you just need to point it to your existing project folders and forward the appropriate arguments. There is a lot of customizability to it (customizing each step, for example). If you want I could make an example exactly like your provided example directory structure, but I think both of my personal usages closely match what you are wanting to do. On Tue, Mar 8, 2016 at 7:02 PM, Muhammad Osama wrote: > Thank you for your suggestion Nicholas, I have never used > ExternalProject_Add before and can't find a related example to my project. > Would you know an example that uses it? > > On Tue, Mar 8, 2016 at 10:38 AM, Nicholas Braden < > nicholas11bra...@gmail.com> wrote: > >> Have you looked into ExternalProject_Add? It allows just using a local >> path instead of downloading a remote repository: >> >> https://cmake.org/cmake/help/latest/module/ExternalProject.html >> >> On Tue, Mar 8, 2016 at 12:12 PM, Muhammad Osama >> wrote: >> >>> Hi Jan, >>> >>> Thank you for your reply, I am in the similar situation, have a very >>> similar implementation using *target_*** *but since I don't do that for >>> ALL the dependencies, I am unable to cmake or compile individual projects >>> in the sub directories. So, few questions; >>> >>> 1. This still requires me to run cmake on the root CMakeLists.txt to set >>> the flags and what not before I run the sub project to make it correct? >>> 1a. If so, how can I make the CMakeLists.txts in the sub directories >>> independent of the root one if I want to just compile the sub-project and >>> not cmake the whole thing? >>> 2. Another question is that your implementation, does it not include a >>> config file? In theory you're copy pasting most of the dependencies in the >>> CMakeLists.txt of root into the sub-dir ones? Is there a better way to do >>> this? >>> >>> Thank you! >>> >>> On Tue, Mar 8, 2016 at 2:02 AM, 🐋 Jan Hegewald >>> wrote: >>> >>>> Hi Muhammad, >>>> >>>> > On 08.03.2016, at 06:17, Muhammad Osama wrote: >>>> > >>>> > Hi, I am new to cmake and really hope am doing this correctly. I >>>> asked stackoverflow but didn't get a good enough answer for my specific >>>> problem here; >>>> > >>>> > If I want root/sub-directories/ as separate sub-projects that can be >>>> compiled using the individualCMakeLists.txts in their folders I find myself >>>> literally copy pasting almost the entire root file CMakeLists.txt per >>>> sub-directory. >>>> > >>>> > I was wondering if there is a better way to have a main project and >>>> then sub-projects that get the shared dependencies from main project and >>>> can be compiled without cmake-ing the root CMakeLists.txt. My directory >>>> structure is; >>>> > >>>> > CMakeLists.txt (root project) >>>> > | __ sub_dir-1 >>>> > | __ | __ CMakeLists.txt (sub-project) >>>> > | __ sub_dir-2 >>>> > | __ | __ CMakeLists.txt (sub-project) >>>> > | __ sub_dir-3 >>>> > | __ | __ CMakeLists.txt (sub-project) >>>> >>>> I basically have the same project structure as you describe. I am also >>>> not sure what the best practice is here, but this is what I currently do: >>>> I set all dependencies where they are required: right in the local >>>> CMakeLists.txt, i.e. sub_dir-1/CMakeLists.txt. Then "export" all required >>>> include/define/compiler flags dependencies via INTERFACE or PUBLIC flags of >>>> the various target_*** cmake functions, as appropriate. The sub-projects >>>> are added via add_subdirectory in cmake. >>>> This way I can build each CMakeLists.txt individually if needed but >>>> still have everything DRYish. >>>> >>>> HTH, >>>> Jan >>>> >>>> -- >>>> >>>> Powered by www.kitware.com >>>> >>>> Please keep messages on-topi
Re: [CMake] Create main and sub-projects; be able to compile them together and individually.
Have you looked into ExternalProject_Add? It allows just using a local path instead of downloading a remote repository: https://cmake.org/cmake/help/latest/module/ExternalProject.html On Tue, Mar 8, 2016 at 12:12 PM, Muhammad Osama wrote: > Hi Jan, > > Thank you for your reply, I am in the similar situation, have a very > similar implementation using *target_*** *but since I don't do that for > ALL the dependencies, I am unable to cmake or compile individual projects > in the sub directories. So, few questions; > > 1. This still requires me to run cmake on the root CMakeLists.txt to set > the flags and what not before I run the sub project to make it correct? > 1a. If so, how can I make the CMakeLists.txts in the sub directories > independent of the root one if I want to just compile the sub-project and > not cmake the whole thing? > 2. Another question is that your implementation, does it not include a > config file? In theory you're copy pasting most of the dependencies in the > CMakeLists.txt of root into the sub-dir ones? Is there a better way to do > this? > > Thank you! > > On Tue, Mar 8, 2016 at 2:02 AM, 🐋 Jan Hegewald > wrote: > >> Hi Muhammad, >> >> > On 08.03.2016, at 06:17, Muhammad Osama wrote: >> > >> > Hi, I am new to cmake and really hope am doing this correctly. I asked >> stackoverflow but didn't get a good enough answer for my specific problem >> here; >> > >> > If I want root/sub-directories/ as separate sub-projects that can be >> compiled using the individualCMakeLists.txts in their folders I find myself >> literally copy pasting almost the entire root file CMakeLists.txt per >> sub-directory. >> > >> > I was wondering if there is a better way to have a main project and >> then sub-projects that get the shared dependencies from main project and >> can be compiled without cmake-ing the root CMakeLists.txt. My directory >> structure is; >> > >> > CMakeLists.txt (root project) >> > | __ sub_dir-1 >> > | __ | __ CMakeLists.txt (sub-project) >> > | __ sub_dir-2 >> > | __ | __ CMakeLists.txt (sub-project) >> > | __ sub_dir-3 >> > | __ | __ CMakeLists.txt (sub-project) >> >> I basically have the same project structure as you describe. I am also >> not sure what the best practice is here, but this is what I currently do: >> I set all dependencies where they are required: right in the local >> CMakeLists.txt, i.e. sub_dir-1/CMakeLists.txt. Then "export" all required >> include/define/compiler flags dependencies via INTERFACE or PUBLIC flags of >> the various target_*** cmake functions, as appropriate. The sub-projects >> are added via add_subdirectory in cmake. >> This way I can build each CMakeLists.txt individually if needed but still >> have everything DRYish. >> >> HTH, >> Jan >> >> -- >> >> 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 >> > > > > -- > *Muhammad Osama* > Graduate Student > Department of Electrical and Computer Engineering > University of California, Davis > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Some Visual Studio/CMake questions
IIRC, the project() command can be called once per directory. So you can have each directory be a separate project via add_subdirectory(). I just tried it out and it seems to create a solution (*.sln) for each project(). I can't answer the other questions, sorry. On Tue, Mar 8, 2016 at 10:03 AM, Jakob van Bethlehem wrote: > Dear users, > > Since about a year I work on a project that uses CMake in combination with > Visual Studio. This works kind of oke, but over time some questions have > emerged. Hopefully I can get an answer on this list: > > * Our build infrastructure creates a Release and a Debug configuration by > setting the CMAKE_CONFIGURATION_TYPES variable. However, when switching > between these configurations, Visual Studio almost kills itself, and becomes > unresponding for quite some time. Is this a known issue with Visual Studio > and CMake-generated solutions? Or is there something we can do to improve > this? > > * The generated solution file makes sure that CMake is ran again if any > change in one of the CMakeLists.txt file is detected. What we typically see > however, is that afterwards Visual Studio recompiles loads of files that > were not changed, and that were already compiled before. It seems that the > CMake run someone makes Visual Studio believe that all, or at least way too > many, files are out of date and need to be recompiled. We make use of a > Visual Studio plugin that provides a bunch of smart functions, which scans > the files in the solution in order to do its job. This plugin has the same > behaviour, so it seems like CMake is the common denominator causing > behaviour one wouldn't expect or want. > Same question: known issue, or something we can improve somehow? > > * Over time I have seen a view times that it was mentioned that it is > possible to call the 'project()' function multiple times, and that this will > produce separate Visual Studio solution files. Interestingly, this is > documented absolutely nowhere. As a matter of fact, the documentation of the > 'project()' function clearly states that you should call that function only > once, and exactly once. > > What about it? Is this some undocumented feature we can rely on? Or is this > a serious bug, that many people incidentally have come to rely upon. If this > is considered a feature, will this feature remain working for the > foreseeable future? If yes is the answer to these questions, what *exactly* > does this feature contain, so where *can* I get documentation? My main > question is whether it is possible to create dependencies between projects, > i.e. solution files, and will CMake generate calls to msbuild that will > automatically take care that dependencies between solution files are handled > properly? > > Hopefully someone can help me out a bit here! > > Sincerely, > Jakob van Bethlehem > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] find_package REQUIRED ignores OPTIONAL_COMPONENTS
Jakob, I don't think there is any confusion about what REQUIRED means. Whether or not REQUIRED is provided, the list of OPTIONAL_COMPONENTS should not be required under any circumstances. The example error message seems pretty clear to me that the expected behavior and actual behavior are different. I went and looked at the source code of the find module: https://github.com/Kitware/CMake/blob/master/Modules/FindQt4.cmake It seems that there is no check whatsoever for Qt4_FIND_REQUIRED_, so the find module just blindly assumes that all components are required. More info: https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules To me this seems like a bug in the find module. On Tue, Mar 8, 2016 at 9:34 AM, Jakob van Bethlehem wrote: > Hej Alexander, > > Yes, you're missing a subtle detail. You assume that the 'REQUIRED' keyword > reflects the fact that COMPONENTS are required. This is not the case. The > REQUIRED keyword reflects that the entire package Qt4 is required, see > https://cmake.org/cmake/help/v3.0/command/find_package.html where it says: > 'The REQUIRED option stops processing with an error message if the package > cannot be found' > > Confusing, I agree. > > Sincerely, > Jakob > > On Fri, Mar 4, 2016 at 9:18 AM, Alexander Stein > wrote: >> >> Hi, >> >> I want to use some required Qt component while others are optional. >> Apparently if you specify REQUIRED in find_package OPTIONAL_COMPONENTS is >> ignored. >> Here is a minimal CMakeLists.txt: >> project(test) >> cmake_minimum_required(VERSION 3.5) >> >> find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui OPTIONAL_COMPONENTS >> Invalid) >> >> /home/alex/repo/cmake/build/bin/cmake --version >> cmake version 3.5.20160303-gf37f >> >> cmake fails with: >> CMake Error at >> /home/alex/repo/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 >> (message): >> Could NOT find Qt4 (missing: QT_INVALID_INCLUDE_DIR QT_INVALID_LIBRARY) >> (found version "4.8.7") >> Call Stack (most recent call first): >> /home/alex/repo/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 >> (_FPHSA_FAILURE_MESSAGE) >> /home/alex/repo/cmake/Modules/FindQt4.cmake:1333 >> (FIND_PACKAGE_HANDLE_STANDARD_ARGS) >> CMakeLists.txt:4 (find_package) >> >> I expected that if required components are missing cmake bails out while >> continuing when OPTIONAL_COMPONENTS are missing. My current workaround is: >> find_package(Qt4 OPTIONAL_COMPONENTS Invalid) >> find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui) >> >> But I would rather use a single line. Am I missing something here? >> >> Best regards, >> Alexander >> >> -- >> >> 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
Re: [CMake] Subprojects and Cmake?
If you are using the add_subdirectory approach, I believe you should not be using find_package and instead you just need to use target_link_libraries to have everything handled for you. Another approach would be making a superproject that builds your dependencies and your own project via ExternalProject_Add - this generally works well especially since it allows the user to easily customize the build of each dependency or use an existing install, and you don't have to worry about name collisions. On Sun, Mar 6, 2016 at 12:00 PM, Juhani Karlsson wrote: > Hi everyone, > > I`m having beginner problems how to include another Cmake project into > another properly! (NanoGui) > > At the moment I`m using simply the add_subdirectory() command and then > target_link_libraries to link it to the project. > Seems to build fine, but when I try to include NanoGui in the project cannot > find it correctly. What is the preferred workflow for this? > > I`m using Clion, GCC and built in CMake 3.3. > > Be gentle - total CMake newbie here : ) Image of the project and > CMakeLists.txt in the attachments! > > I hope you can help! > Thanks, > - Juhani > > -- > -- > Juhani Karlsson > 3D Artist/TD > > Talvi Digital Oy > Tehtaankatu 27a > 00150 Helsinki > +358 443443088 > juhani.karls...@talvi.fi > www.vimeo.com/talvi > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Install from a source directory with ExternalProject
For reference, the issue isn't uncompression, it's that the link you provided is an HTML document generated by the web server to list the files in that directory for humans and not machines :) On Fri, Feb 26, 2016 at 9:10 AM, Cedric Doucet wrote: > > Thank you very much Nicholas! > For the moment, option B sounds better for me. :) > > I think it could be helpful to be able to disable the uncompression step of > ExternalProject_Add, > or to control it with a variable named UNCOMPRESSION_COMMAND or something > similar. > > Cheers, > > Cédric > > > > > - Mail original - >> De: "Nicholas Braden" >> À: "Cedric Doucet" >> Cc: cmake@cmake.org >> Envoyé: Vendredi 26 Février 2016 15:56:02 >> Objet: Re: [CMake] Install from a source directory with ExternalProject >> >> Hmm, if it were available as an FTP share you may have been able to >> use a command line program via DOWNLOAD_COMMAND, but in this case I >> think you really only have two options: >> >> A. Write a small portable program compiled as part of your project, >> with its task being to download that directory. Make sure the external >> project DEPENDS on it and use it as the DOWNLOAD_COMMAND. >> >> B. If the directory in question does not change often, you can >> probably get away with just maintaining several file(DOWNLOAD) >> statements. >> >> Someone else may know better than me; there may be something I >> overlooked. But for now, this is all I can think of. >> >> On Fri, Feb 26, 2016 at 8:45 AM, Cedric Doucet >> wrote: >> > >> > Hello Nicholas, >> > >> > thank you for your answer. >> > Actually, it's not my own directory and I have no choice. >> > I want to download source files from there : >> > http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c++/ >> > I know how to do it with FILE(DOWNLOAD ...) but I would like to know if >> > there is a way to do it with ExternalProject_Add. >> > >> > Cédric >> > >> > >> > >> > - Mail original - >> >> De: "Nicholas Braden" >> >> À: "Cedric Doucet" >> >> Cc: cmake@cmake.org >> >> Envoyé: Vendredi 26 Février 2016 15:40:26 >> >> Objet: Re: [CMake] Install from a source directory with ExternalProject >> >> >> >> I'm not sure how you would download a directory without it being in >> >> some sort of archive. If you just want to use an existing directory, >> >> use the SOURCE_DIR option instead. >> >> >> >> On Fri, Feb 26, 2016 at 8:37 AM, Cedric Doucet >> >> wrote: >> >> > >> >> > Hello, >> >> > >> >> > I would like to know if it's possible to download and install an >> >> > external >> >> > project from a source directory instead of a tarball. >> >> > I tried to do it with ExternalProject_Add function but it tries to >> >> > uncompress source files and then fails. >> >> > >> >> > Cédric >> >> > >> >> > -- >> >> > >> >> > Powered by www.kitware.com >> >> > >> >> > Please keep messages on-topic and check the CMake FAQ at: >> >> > http://www.cmake.org/Wiki/CMake_FAQ >> >> > >> >> > Kitware offers various services to support the CMake community. For more >> >> > information on each offering, please visit: >> >> > >> >> > CMake Support: http://cmake.org/cmake/help/support.html >> >> > CMake Consulting: http://cmake.org/cmake/help/consulting.html >> >> > CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> > >> >> > Visit other Kitware open-source projects at >> >> > http://www.kitware.com/opensource/opensource.html >> >> > >> >> > Follow this link to subscribe/unsubscribe: >> >> > http://public.kitware.com/mailman/listinfo/cmake >> >> >> -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Install from a source directory with ExternalProject
Hmm, if it were available as an FTP share you may have been able to use a command line program via DOWNLOAD_COMMAND, but in this case I think you really only have two options: A. Write a small portable program compiled as part of your project, with its task being to download that directory. Make sure the external project DEPENDS on it and use it as the DOWNLOAD_COMMAND. B. If the directory in question does not change often, you can probably get away with just maintaining several file(DOWNLOAD) statements. Someone else may know better than me; there may be something I overlooked. But for now, this is all I can think of. On Fri, Feb 26, 2016 at 8:45 AM, Cedric Doucet wrote: > > Hello Nicholas, > > thank you for your answer. > Actually, it's not my own directory and I have no choice. > I want to download source files from there : > http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c++/ > I know how to do it with FILE(DOWNLOAD ...) but I would like to know if there > is a way to do it with ExternalProject_Add. > > Cédric > > > > - Mail original - >> De: "Nicholas Braden" >> À: "Cedric Doucet" >> Cc: cmake@cmake.org >> Envoyé: Vendredi 26 Février 2016 15:40:26 >> Objet: Re: [CMake] Install from a source directory with ExternalProject >> >> I'm not sure how you would download a directory without it being in >> some sort of archive. If you just want to use an existing directory, >> use the SOURCE_DIR option instead. >> >> On Fri, Feb 26, 2016 at 8:37 AM, Cedric Doucet >> wrote: >> > >> > Hello, >> > >> > I would like to know if it's possible to download and install an external >> > project from a source directory instead of a tarball. >> > I tried to do it with ExternalProject_Add function but it tries to >> > uncompress source files and then fails. >> > >> > Cédric >> > >> > -- >> > >> > Powered by www.kitware.com >> > >> > Please keep messages on-topic and check the CMake FAQ at: >> > http://www.cmake.org/Wiki/CMake_FAQ >> > >> > Kitware offers various services to support the CMake community. For more >> > information on each offering, please visit: >> > >> > CMake Support: http://cmake.org/cmake/help/support.html >> > CMake Consulting: http://cmake.org/cmake/help/consulting.html >> > CMake Training Courses: http://cmake.org/cmake/help/training.html >> > >> > Visit other Kitware open-source projects at >> > http://www.kitware.com/opensource/opensource.html >> > >> > Follow this link to subscribe/unsubscribe: >> > http://public.kitware.com/mailman/listinfo/cmake >> -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Install from a source directory with ExternalProject
I'm not sure how you would download a directory without it being in some sort of archive. If you just want to use an existing directory, use the SOURCE_DIR option instead. On Fri, Feb 26, 2016 at 8:37 AM, Cedric Doucet wrote: > > Hello, > > I would like to know if it's possible to download and install an external > project from a source directory instead of a tarball. > I tried to do it with ExternalProject_Add function but it tries to > uncompress source files and then fails. > > Cédric > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] cmake documentation incomplete
I don't know about -B, but you can take advantage of the tool mode like this: cmake -E chdir path/to/build cmake [options] path/to/source Effectively you can use the chdir tool to spawn CMake with the working directory you want it to have. On Thu, Feb 25, 2016 at 9:37 AM, Vania Joloboff wrote: > Thanks Nicholas, > > Then if I run cmake from a shell script in working directory pwd > (and I do not want to cd) > can I tell cmake the first time to take the source > in path-to-source and do the build in path-to-build ? > > I have read there is an undocumented option -B to do this ? > > Vania > > > On 02/25/2016 04:16 PM, Nicholas Braden wrote: >> >> Yes, an existing build saves all the information it needs in the build >> cache. Once you have created a build, you never need to specify the >> source directory again. >> >> On Thu, Feb 25, 2016 at 9:13 AM, Vania Joloboff >> wrote: >>> >>> Hi, >>> >>> The cmake documentation says there are two alternatives >>> to start cmake >>> >>> cmake [] ( | ) >>> >>> But it does not explain nowhere the difference between the two... >>> Does the path-to-existing-build retrieve itself the source dir >>> and start like if it were invoked with path-to-source >>> from path-to-existing-build working directory ? >>> >>> Vania >>> >>> -- >>> >>> Powered by www.kitware.com >>> >>> Please keep messages on-topic and check the CMake FAQ at: >>> http://www.cmake.org/Wiki/CMake_FAQ >>> >>> Kitware offers various services to support the CMake community. For more >>> information on each offering, please visit: >>> >>> CMake Support: http://cmake.org/cmake/help/support.html >>> CMake Consulting: http://cmake.org/cmake/help/consulting.html >>> CMake Training Courses: http://cmake.org/cmake/help/training.html >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/cmake > > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] cmake documentation incomplete
Yes, an existing build saves all the information it needs in the build cache. Once you have created a build, you never need to specify the source directory again. On Thu, Feb 25, 2016 at 9:13 AM, Vania Joloboff wrote: > Hi, > > The cmake documentation says there are two alternatives > to start cmake > > cmake [] ( | ) > > But it does not explain nowhere the difference between the two... > Does the path-to-existing-build retrieve itself the source dir > and start like if it were invoked with path-to-source > from path-to-existing-build working directory ? > > Vania > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] ExternalProject question
You will need to look at their building documentation to find how to set those preferences when building with CMake. On Sat, Feb 6, 2016 at 11:47 PM, vadtec wrote: > I'm using ExternalProject to build external dependencies. curl provides a > cmake build process, but I cannot figure out how to pass options such as: > > --disable-manual --disable-shared --without-librtmp --without-libidn > --without-winidn --without-winssl --disable-ldap --disable-ldaps > --enable-ipv6 --enable-threaded-resolver --enable-cookies --enable-static > > to the build process. The only way I've found to get it to work is to use a > custom CONFIGURE_COMMAND and related steps. I would prefer to use the cmake > build process. > > This is what I have that works: > > ExternalProject_Add( > CURL > DEPENDS OPENSSL ZLIB OPENSSH > SOURCE_DIR ${PROJECT_BINARY_DIR}/deps/curl-7.43.0/ > PREFIX ${PROJECT_BINARY_DIR}/deps/curl-7.43.0/ > DOWNLOAD_COMMAND tar xvjf ${PROJECT_BINARY_DIR}/deps/curl-7.43.0.tar.bz2 > DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/deps/ > CONFIGURE_COMMAND cd ${PROJECT_BINARY_DIR}/deps/curl-7.43.0/ && > ./configure --prefix=${PROJECT_BINARY_DIR}/deps/binary/linux/ > --disable-manual --disable-shared --without-librtmp --without-libidn > --without-winidn --without-winssl --disable-ldap --disable-ldaps > --enable-ipv6 --enable-threaded-resolver --enable-cookies --enable-static > BUILD_COMMAND cd ${PROJECT_BINARY_DIR}/deps/curl-7.43.0/ && make > INSTALL_COMMAND "" > ) > > I want to use this, so that cmake can do its thing while still giving me the > specific variant of curl I want: > > ExternalProject_Add( > CURL > DEPENDS OPENSSL ZLIB OPENSSH > SOURCE_DIR ${PROJECT_BINARY_DIR}/deps/curl-7.43.0/ > PREFIX ${PROJECT_BINARY_DIR}/deps/curl-7.43.0/ > DOWNLOAD_COMMAND tar xvjf ${PROJECT_BINARY_DIR}/deps/curl-7.43.0.tar.bz2 > DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/deps/ > CMAKE_ARGS > -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/deps/binary/linux/ > -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} > -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} > -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} > -DCMAKE_MOUDLE_PATH=${MAKE_MOUDLE_PATH} > INSTALL_COMMAND "" > ) > > > Vadtec > vad...@vadtec.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 -- 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] Is there any way to use clang-cl with MSBuild on Windows?
Have you tried setting the toolset? The -T parameter can set the toolset. This sets the platform toolset property that you would normally set in Visual Studio. if Visual Studio lets you select the llvm platform toolset, so will CMake. On Fri, Jan 29, 2016 at 12:04 PM, Yi-Hong Lyu wrote: > Hello everyone, > > I am a newbie of CMake. I would like to use clang-cl with MSBuild on > Windows. However it always use MSVC 19.0.23506.0 as the identified compiler > even I defined CMAKE_C_COMPILER / CMAKE_CXX_COMPILER / > CMAKE_C_COMPILER_FORCED / CMAKE_CXX_COMPILER_FORCED: > > $ cmake -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl > -DCMAKE_C_COMPILER_FORCED=ON -DCMAKE_CXX_COMPILER_FORCED=ON ..\src\ > -- Building for: Visual Studio 14 2015 > -- The CXX compiler identification is MSVC 19.0.23506.0 > -- The C compiler identification is MSVC 19.0.23506.0 > -- Configuring for standalone build. > -- Found PythonInterp: C:/Python34/python.exe (found version "3.4.4") > -- Sphinx disabled. > . > . > . > > PS. The environment PATH is already set to clang-cl. > > I am wondering whether there is any option that I can force MSBuild use > clang-cl instead. > > Thanks, > Yi-Hong > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Library target names and the ExternalProject_Add command
ExternalProject makes no assumptions about what is being built. It could just be a collection of executables, or maybe nothing is built at all. It is up to the project being built to provide facilities for accessing its targets in a platform-independent way. For example, the external project can install an export file that you can include to get the imported targets. Or, it could have a traditional FindXXX.cmake script that you can use. Either way, ExternalProject doesn't know about any of that - it just downloads and builds stuff. Alternatively, you could include the external library as part of your project and use add_subdirectory to just build it with the rest of your project, thus giving you direct access to the targets you want. On Mon, Jan 25, 2016 at 4:22 AM, Cedric Doucet wrote: > > Hello, > > I use the ExternalProject_Add command to download and build a static library > called 'foo.a'. > I build another library 'bar' which depends on 'foo.a'. > > For the moment, I use the target_link_libraries command to create a link > between foo and bar: > > target_link_libraries(bar ${FOO_INSTALL_DIR}/lib/foo.a) > > However, this approach is not portable, especially if I want foo to be a > shared library. > Indeed, the extension of such libraries is plateform dependent. > > Therefore, I tried to replace the path to foo by its name 'foo' from the > call to the ExternalProject_Add command: > > target_link_libraries(bar foo) > > However, it does not work and I get the following error message: > > Target "foo" of type UTILITY may not be linked into another target. > One may link only to STATIC or SHARED libraries, or to executables with > the > ENABLE_EXPORTS property set. > > I guess I understand that foo has the wrong type UTILITY and it would work > only if I had defined my target like this: > > add_library(foo blablabla) > > However, I need to use the ExternalProject_Add command. > > Is there a way to create a library target name 'foo' in this case? > > Thank you! > > Cédric > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] exclude a dependency from export
Have you tried using the PRIVATE keyword when linking to A? https://cmake.org/cmake/help/latest/command/target_link_libraries.html#libraries-for-a-target-and-or-its-dependents On Fri, Jan 22, 2016 at 9:14 AM, Jack Stalnaker wrote: > Is there any way to exclude a dependency from an export? If I build a static > library target "A" but do not wish to install it, and then link that target > to another target "B" using target_link_libraries(B A), and then attempt to > export B, I get the error message: > > install (EXPORT "B" ...) includes target "B" which requires target "A" that > is not in the export set. > > I can solve the problem by installing A, but there is no need to. It is a > temporary target that is statically linked. I just need to export for > creating a package config file, so there's no need for the package config to > ever need to worry about statically linked libraries. > > Is there a workaround for this? > > Long story short, I am trying to replicate convenience libraries from > autotools. I'm having a hell of time doing it. I can use lists of sources, > but that requires passing around global variables that include the sources > and others that include the required libraries. This is far messier and far > less convenient. I've tried object libraries, and while they eliminate the > global source variables and prevent rebuilding things, they fail when the > source is nested, and you want to build a "super library" from smaller > object libraries, which I believe is a fairly common working pattern. > Building a static library that is never installed works really well ... > until I go to create a package config file. Then this export fails. > > Thanks, > --Jack > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] ExternalProject_Add() macro does not set CMAKE_COMPILER_IS_GNUCXX
Ah, I ran into this quirk too - the issue is that you have the quotes incorrect: -DCMAKE_CXX_FLAGS="-march=native" Should be like this instead: "-DCMAKE_CXX_FLAGS=-march=native" Try that and see if it helps, I am pretty sure I ran into the exact same problem. On Thu, Jan 21, 2016 at 8:27 AM, fkillus wrote: > Thanks for clarifying that external projects are not aware of the project > they are embedded in. > The CMAKE_COMPILER_IS_GNUCXX variable should be set automatically by CMake > as far > as I understand it (see https://cmake.org/Wiki/CMake_Useful_Variables). > > I narrowed down the problem by creating a minimal setup which still > reproduces the issue. > In this case the super project is simply a wrapper around an external dummy > project. > > external/CMakeLists.txt: > > cmake_minimum_required( VERSION 3.4 ) > project( external ) > message( "External - CMAKE_COMPILER_IS_GNUCXX: " > ${CMAKE_COMPILER_IS_GNUCXX} ) > message( "External - CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) > message( "External - CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} ) > > super/CMakeLists.txt: > > cmake_minimum_required( VERSION 3.4 ) > project( super ) > message( "Super - CMAKE_COMPILER_IS_GNUCXX: " ${CMAKE_COMPILER_IS_GNUCXX} > ) > message( "Super - CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) > message( "Super - CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} ) > include( ExternalProject ) > ExternalProject_Add( > external > DOWNLOAD_COMMAND "" > SOURCE_DIR ${CMAKE_SOURCE_DIR}/../external > CMAKE_ARGS > -DCMAKE_CXX_FLAGS="-march=native" > INSTALL_COMMAND "" > ) > > The problem occurs when the CMAKE_CXX_FLAGS variable is set inside the > ExternalProject_Add > command using quotes (i.e. "-march=native" in this example). The output > obtained when configuring > the super project with 'cmake ../super' is: > > -- The C compiler identification is GNU 5.2.0 > -- The CXX compiler identification is GNU 5.2.0 > -- 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 > -- Check for working CXX compiler: /usr/bin/c++ > -- Check for working CXX compiler: /usr/bin/c++ -- works > -- Detecting CXX compiler ABI info > -- Detecting CXX compiler ABI info - done > -- Detecting CXX compile features > -- Detecting CXX compile features - done > Super - CMAKE_COMPILER_IS_GNUCXX: 1 > Super - CMAKE_CXX_COMPILER_ID: GNU > Super - CMAKE_CXX_FLAGS: > -- Configuring done > -- Generating done > > Afterwards building with 'make' results in: > > [ 12%] Creating directories for 'external' > [ 25%] No download step for 'external' > [ 37%] No patch step for 'external' > [ 50%] No update step for 'external' > [ 62%] Performing configure step for 'external' > -- The C compiler identification is GNU 5.2.0 > -- The CXX compiler identification is unknown > -- 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 > -- Check for working CXX compiler: /usr/bin/c++ > -- Check for working CXX compiler: /usr/bin/c++ -- works > -- Detecting CXX compiler ABI info > -- Detecting CXX compiler ABI info - done > External - CMAKE_COMPILER_IS_GNUCXX: > External - CMAKE_CXX_COMPILER_ID: > External - CMAKE_CXX_FLAGS: "-march=native" > -- Configuring done > -- Generating done > > This shows the compiler is not correctly identified for the external > project. Directly configuring > the external project with 'cmake -DCMAKE_CXX_FLAGS="-march=native" > ../external' works though: > > -- The C compiler identification is GNU 5.2.0 > -- The CXX compiler identification is GNU 5.2.0 > -- 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 > -- Check for working CXX compiler: /usr/bin/c++ > -- Check for working CXX compiler: /usr/bin/c++ -- works > -- Detecting CXX compiler ABI info > -- Detecting CXX compiler ABI info - done > -- Detecting CXX compile features > -- Detecting CXX compile features - done > External
Re: [CMake] ExternalProject_Add() macro does not set CMAKE_COMPILER_IS_GNUCXX
Where/how is that variable normally set? External projects have no awareness of the project they are in, they just run CMake as usual the same way you would. If the variable is normally set by CMake itself, make sure that your containing project and the external project both find the same compiler. (They each do their own automatic search for compilers) On Wed, Jan 20, 2016 at 11:41 AM, fkillus via CMake wrote: > I have been trying to compile Ogre [1] as external dependency with > ExternalProject_Add(). In theory this should be straightforward since Ogre > itself also uses CMake as buildsystem. However, in the process I encountered > the following problem: > > Ogre checks the value of the CMAKE_COMPILER_IS_GNUCXX variable in some > places (e.g. [2]). I am running Linux and compiling with g++ and everything > works fine if I manually configure Ogre with cmake or cmake-gui. > Unfortunately, after wrapping everything inside ExternalProject_Add(), the > CMAK_COMPILER_IS_GNUCXX variable is no longer being set correctly. > > A simple workaround is to manually set this variable, i.e.: > > ExternalProject_Add( > ogre > URL https://bitbucket.org/sinbad/ogre/get/v1-9-0.zip > CMAKE_ARGS > -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_OUTPUT_DIR} > -DCMAKE_COMPILER_IS_GNUCXX=${CMAKE_COMPILER_IS_GNUCXX} # workaround > ) > > This works, but I'm uncertain if this should be necessary. Is this a bug or > a feature? > > > [1] https://bitbucket.org/sinbad/ogre > [2] > https://bitbucket.org/sinbad/ogre/src/0d580c7216abe27fafe41cb43e31d8ed86ded591/CMake/Utils/OgreConfigTargets.cmake?at=default&fileviewer=file-view-default#OgreConfigTargets.cmake-277 > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] ExternalProject_Add support for git clone -o option
Why would you like to have names other than origin? I am struggling to think of a use case for this, seeing as you never directly interact with the cloned repository. I don't even think it's safe to assume that a git repository is involved at all, for all you know it could be changed to just download the code and never even involve git. (Maybe it is guaranteed somewhere but I don't see such a guarantee in the documentation) On Fri, Jan 15, 2016 at 10:03 AM, Adam Rankin wrote: > Hello all, > > > > I am reading through the ExternalProject source for 3.2 at the moment (if > updating to 3.4 is the answer, great!) and trying to determine if there is > support for the –o option when using a git repository. > > > > Has anyone accomplished this? I would like to have names other than “origin” > > > > Cheers, > > Adam > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] How do I create targets first and add sources later?
I often find it more convenient to call add_library() and add_executable() first, apply properties to them etc., and then later add the sources to them with target_sources() (usually in other CMake files via add_subdirectory). Obviously, all my targets will eventually have sources added. However, CMake completely errors out as soon as it sees me creating a target with no sources - it doesn't even care that I am adding sources to it later. Example: "You have called ADD_LIBRARY for library mylib without any source files. This typically indicates a problem with your CMakeLists.txt file" I have been working around this by adding a dummy source file or adding one of the sources ahead of time, but this is somewhat inconvenient. Is there a better way to do this? Alternatively, could CMake be changed to allow creating a target that initially has no sources as long as it eventually has sources added to it? Note: I am familiar with the approach of gathering a list of source files before creating the target, but this is really inconvenient to do across multiple files in multiple directories. It is easier to call target_sources() instead. -- 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 based package manager
Hh, sorry, I should have found that myself! This definitely looks interesting, and I agree that not requiring an external program like Biicode is a good idea. Thanks for sharing this, I will try it out when I have time :) On Mon, Jan 11, 2016 at 7:40 AM, Cristian Adam wrote: > On Mon, Jan 11, 2016 at 2:33 PM, Nicholas Braden > wrote: >> >> Doesn't biicode already fill this role? Biicode seems to work well >> enough for me, anyway. >> > > Biicode is dead. > > There is a comparison with biicode here: > https://github.com/ruslo/hunter/issues/54 > > Having only CMake as a dependency is awesome! > > I have tried once to reuse biicode's OpenSSL CMake files, I failed. So I > ended up > using perl and whatever OpenSSL needed to compile. > > On the other hand hunter has only CMake as dependency, which means that its > CMake scripts are very portable. > > Cheers, > Cristian. > > -- 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 based package manager
Doesn't biicode already fill this role? Biicode seems to work well enough for me, anyway. On Mon, Jan 11, 2016 at 5:42 AM, Cristian Adam wrote: > Ruslan Baratov via CMake writes: > >> >> Hi, >> >> I'm developing a project that is a kind of wrapper of >> ExternalProject_Add and >> allow it to be more reusable. User interface is quite simple. >> >> For anybody interested, here is a github project: >> >> * https://github.com/ruslo/hunter > > Recently posted on reddit: > https://www.reddit.com/r/cpp/comments/40cfbk/hunter_crossplatform_packag > e_manager_for_c/ > > Any thoughts of including such a project in CMake? > > Cheers, > Cristian. > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] adding external project
I think the issue you are running into is order of execution - when using external projects it is often a good idea to have all the ExternalProject_Add commands in a superproject file with your own project source directory as one of the external projects. This way you can use the DEPENDS parameter to guarantee order of execution - this also makes it so people can just build your project from the source directory if they already have the dependencies, and you can use things like find_package and such. On Tue, Dec 15, 2015 at 4:57 AM, Owen Hogarth II wrote: > oh, that was it a typo! > > A few more questions. I build the project like this: > ExternalProject_Add(sdl > HG_REPOSITORY http://hg.libsdl.org/SDL > UPDATE_COMMAND "" > > CMAKE_ARGS -DSDL_STATIC:BOOL=FALSE > -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/lib > > SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SDL > > INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin > ) > > That seems to build everything and put everything in the right place. > Another thing that I did with other parts of my code was add these lines to > the end of the cmakelists.txt files > > TARGET_INCLUDE_DIRECTORIES(mylib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/headers) > > so that I can just #include "mylib" instead of the path to the file. With > this setup, I can't do target_include_directories from the > external_project_add command, how do I get those headers? > > On Tue, Dec 15, 2015 at 6:26 PM, Nicholas Braden > wrote: >> >> What's the word "clone" doing in there? That should be a URL, not >> command parameters. >> >> On Tue, Dec 15, 2015 at 2:01 AM, Owen Hogarth II >> wrote: >> > I have been reading this: >> > https://cmake.org/cmake/help/v3.0/module/ExternalProject.html >> > >> > trying to add sdl external project but I am having issues. I created a >> > new >> > cmake project to test. >> > >> > I already downloaded the sdl library and can build it correctly by >> > manually >> > calling cmake commands but this is how I'd like to distribute sdl w/ my >> > library. >> > >> > here's my new test cmake: >> > >> > cmake_minimum_required(VERSION2.8) >> > project(sdl_external) >> > >> > include(ExternalProject) >> > >> > ExternalProject_Add(sdl >> > HG_REPOSITORY clone http://hg.libsdl.org/SDL >> > # PREFIX ${CMAKE_SOURCE_DIR}/sdl >> > >> > # SOURCE_DIR ${CMAKE_SOURCE_DIR}/sdl >> > >> > # INSTALL_COMMAND cmake ../ PREFIX=${CMAKE_CURRENT_BINARY_DIR} >> > ) >> > >> > I get this build output: >> > cmake ../ >> > -- The C compiler identification is GNU 4.9.2 >> > -- The CXX 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 >> > -- Check for working CXX compiler: /usr/bin/c++ >> > -- Check for working CXX compiler: /usr/bin/c++ -- works >> > -- Detecting CXX compiler ABI info >> > -- Detecting CXX compiler ABI info - done >> > -- Found Hg: /usr/bin/hg (found version "3.1.2") >> > -- Configuring done >> > -- Generating done >> > -- Build files have been written to: /home/blubee/sdk/test/build >> > Scanning dependencies of target sdl >> > [ 12%] Creating directories for 'sdl' >> > [ 25%] Performing download step (hg clone) for 'sdl' >> > -- Avoiding repeated hg clone, stamp file is up to date: >> > '/home/blubee/sdk/_b/build/test/ >> > build/sdl-prefix/src/sdl-stamp/sdl-hginfo.txt' >> > [ 37%] No patch step for 'sdl' >> > [ 50%] Performing update step (hg pull) for 'sdl' >> > abort: no repository found in ' >> > /home/blubee/sdk/test/build/sdl-prefix/src/sdl' ( >> > .hg not found)! >> > CMakeFiles/sdl.dir/build.make:89: recipe for target >> > 'sdl-prefix/src/sdl-stamp/sdl-update' >> > failed >> > make[2]: *** [sdl-prefix/src/sdl-stamp/sdl-update] Error 255 >> > CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/sdl.dir/all' >> > failed >> > make[1]: *** [CMakeFiles/sdl.dir/all] Error 2 >> > Makefile:76: recipe for target 'all' failed >> > make: *** [all] Error 2 >> > >> > my external build file isn't very ver
Re: [CMake] adding external project
What's the word "clone" doing in there? That should be a URL, not command parameters. On Tue, Dec 15, 2015 at 2:01 AM, Owen Hogarth II wrote: > I have been reading this: > https://cmake.org/cmake/help/v3.0/module/ExternalProject.html > > trying to add sdl external project but I am having issues. I created a new > cmake project to test. > > I already downloaded the sdl library and can build it correctly by manually > calling cmake commands but this is how I'd like to distribute sdl w/ my > library. > > here's my new test cmake: > > cmake_minimum_required(VERSION2.8) > project(sdl_external) > > include(ExternalProject) > > ExternalProject_Add(sdl > HG_REPOSITORY clone http://hg.libsdl.org/SDL > # PREFIX ${CMAKE_SOURCE_DIR}/sdl > > # SOURCE_DIR ${CMAKE_SOURCE_DIR}/sdl > > # INSTALL_COMMAND cmake ../ PREFIX=${CMAKE_CURRENT_BINARY_DIR} > ) > > I get this build output: > cmake ../ > -- The C compiler identification is GNU 4.9.2 > -- The CXX 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 > -- Check for working CXX compiler: /usr/bin/c++ > -- Check for working CXX compiler: /usr/bin/c++ -- works > -- Detecting CXX compiler ABI info > -- Detecting CXX compiler ABI info - done > -- Found Hg: /usr/bin/hg (found version "3.1.2") > -- Configuring done > -- Generating done > -- Build files have been written to: /home/blubee/sdk/test/build > Scanning dependencies of target sdl > [ 12%] Creating directories for 'sdl' > [ 25%] Performing download step (hg clone) for 'sdl' > -- Avoiding repeated hg clone, stamp file is up to date: > '/home/blubee/sdk/_b/build/test/ > build/sdl-prefix/src/sdl-stamp/sdl-hginfo.txt' > [ 37%] No patch step for 'sdl' > [ 50%] Performing update step (hg pull) for 'sdl' > abort: no repository found in ' > /home/blubee/sdk/test/build/sdl-prefix/src/sdl' ( > .hg not found)! > CMakeFiles/sdl.dir/build.make:89: recipe for target > 'sdl-prefix/src/sdl-stamp/sdl-update' > failed > make[2]: *** [sdl-prefix/src/sdl-stamp/sdl-update] Error 255 > CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/sdl.dir/all' failed > make[1]: *** [CMakeFiles/sdl.dir/all] Error 2 > Makefile:76: recipe for target 'all' failed > make: *** [all] Error 2 > > my external build file isn't very verbose but I don't get the error > > why is it reporting that no repository found. > abort: no repository found in > '/home/blubee/sdk/test/build/sdl-prefix/src/sdl' ( > .hg not found)! > > Why isn't the mercurial project not being downloaded? > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] How to build cmake to have http support?
Have you tried installing the required parts locally (e.g. in your home directory) and just telling CMake to look there instead of the default system locations? On Sun, Nov 15, 2015 at 9:52 AM, Cedric Doucet wrote: > > Thank you Gregor! > > As I feared, this solution does not work in my particular case. > This is because something is missing in the system and I can't installed it > since I'm not an administrator of the cluster: > > -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) > CMake Error at CMakeLists.txt:279 (message): > CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found! > Call Stack (most recent call first): > CMakeLists.txt:546 (CMAKE_BUILD_UTILITIES) > > > -- Configuring incomplete, errors occurred! > See also "/home/doucetc/logiciels/cmake-3.4.0/CMakeFiles/CMakeOutput.log". > See also "/home/doucetc/logiciels/cmake-3.4.0/CMakeFiles/CMakeError.log". > - > Error when bootstrapping CMake: > Problem while running initial CMake > - > > I know it's possible to overcome this problem by installing openssl and > telling cmake to use it, because it worked for me before. > I will try again to find how I did that. > > Best, > > Cédric > > > > - Mail original - >> De: "Gregor Jasny" >> À: cmake@cmake.org, "cedric doucet" >> Envoyé: Dimanche 15 Novembre 2015 15:25:37 >> Objet: Re: [CMake] How to build cmake to have http support? >> >> Hello, >> >> On 14/11/15 20:23, Cedric Doucet wrote: >> > I managed to compile cmake such that it support https by the past, but I >> > can't remember how I did it. >> > I remember I installed openssl and pass some flags to cmake. >> > >> > Could anyone remember me how to do it? >> >> HTTPS support worked for me after passing --system-curl to configure. >> >> Thanks, >> Gregor >> > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Creating relocatable export files
Instead of using FOO_INCLUDE_DIR, I believe you should use target_include_directories() with the INTERFACE or PUBLIC options - this will export the include directories properly and they will be used when someone target_link_library()s your exported target. https://cmake.org/cmake/help/latest/command/target_include_directories.html?highlight=INTERFACE There seems to be a section in the documentation on making sure your packages are relocatable: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-relocatable-packages See also: https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html As for recursively finding packages, I honestly don't know on this front. I would imagine that everything might work if everything was using exported/imported targets, but I'm not sure. The problem is that you have to consider what happens if you relocate your relocatable package to a system that doesn't have the dependencies installed. I don't think exported/imported targets or relocatable packages can solve that problem easily, but I am not very knowledgeable in this area myself. On Sat, Nov 14, 2015 at 5:53 AM, Roger Leigh wrote: > Hi, > > I'm wanting to create -config scripts for my libraries so that dependent > projects can find them with find_package and use them transparently. I have > a number of header-only and shared/static libs, and I'd like to retain their > relationships, plus any additional libraries they are linked with. > > I was previously using hand-crafted templates, e.g. with this type of > generated structure: > > --- > set(OME_COMMON_FOUND TRUE) > > set(OME_COMMON_VERSION "5.2.0-pre0-7-gfc53ca3") > set(OME_COMMON_VERSION_MAJOR "5") > set(OME_COMMON_VERSION_MINOR "2") > set(OME_COMMON_VERSION_PATCH "0") > set(OME_COMMON_VERSION_EXTRA "-pre0-7-gfc53ca3") > > find_path(OME_COMMON_INCLUDE_DIR ome/common/module.h HINTS > "/tmp/split/include") > find_library(OME_COMMON_LIBRARY NAMES ome-common libome-common HINTS > "/tmp/split/lib") > --- > > They unfortuately did not handle interface targets or public library > dependencies required by use in the headers. I've switched to using > install(EXPORT): > > https://github.com/rleigh-dundee/ome-common-cpp/blob/develop/lib/ome/common/CMakeLists.txt#L123 > --- > target_link_libraries(ome-common ome-compat > ${Boost_LOG_SETUP_LIBRARY_RELEASE} > ${Boost_LOG_LIBRARY_RELEASE} > ${Boost_FILESYSTEM_LIBRARY_RELEASE} > ${Boost_SYSTEM_LIBRARY_RELEASE} > ${LibDl_LIBRARIES} > ${XercesC_LIBRARIES}) > > set_target_properties(ome-common PROPERTIES LINKER_LANGUAGE CXX) > set_target_properties(ome-common PROPERTIES VERSION ${OME_VERSION_SHORT}) > > install(TARGETS ome-common > EXPORT ome-common-config > RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} > LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} > ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) > install(EXPORT ome-common-config > DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/ome-common) > --- > > This does a much better job of the dependencies. It's preserving the > dependencies for the internal targets, plus the external libraries. However, > it's lacking: > > - any setting of the include path via FOO_INCLUDE_DIR, unless it's just not > done in an obvious manner > - it's hardcoded the absolute paths of the various boost and xerces libs; > I'd like it to be relocatable so it can work in a superbuild and continue to > work after moving elsewhere > - it doesn't appear to recursively find needed import targets, e.g. I need > to find_package(ome-compat) before find_package(ome-common); it would be > nice if this was transparent so the user doesn't need to do this > > I'd be interested to know if anyone else has run into these issues, and if > so what your solutions were? I'm quite new to this part of cmake, so it may > well just be I'm not doing things exactly as expected. > > Would it be easier to construct the template myself and then call > find_package for the external libs to avoid hardcoding the paths? Is it > safe to recursively call find_package inside find_package? > > > Thanks all, > Roger > -- > > 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/train
[CMake] How do I allow an ExternalProject to fail?
I want to use ExternalProject_Add to download a git repository and try to compile it, and allow it to fail so I can either fall back on another method or disable certain functionality in my project. It looks like try_compile can try to compile a whole project, but I am not sure of an easy way to use this with ExternalProject_Add - I want CMake to automatically download and update the git repository and try to rebuild it again when there are changes, if possible. What would be the best way to go about doing this? I am using CMake 3.4.0 Thanks, Nicholas Braden -- 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