[cmake-developers] [CMake 0015770]: newer version have an additional directory a tarsal generated under mac
The following issue has been SUBMITTED. == http://public.kitware.com/Bug/view.php?id=15770 == Reported By:Charles Doutriaux Assigned To: == Project:CMake Issue ID: 15770 Category: CMake Reproducibility:have not tried Severity: minor Priority: normal Status: new == Date Submitted: 2015-10-05 20:39 EDT Last Modified: 2015-10-05 20:39 EDT == Summary:newer version have an additional directory a tarsal generated under mac Description: some travels generated on Mac get untarred differently since version 3.2 Steps to Reproduce: download tarball at: http://uvcdat.llnl.gov/cdat/resources/x264-snapshot-20150921-2245-stable.tar.gz This tarsal contains mac "." files including on in the top directory: -rwxr-xr-x 0 fries2 38282 222 Sep 21 13:45 ./._x264-snapshot-20150921-2245-stable drwxr-xr-x 0 fries2 38282 0 Sep 21 13:45 x264-snapshot-20150921-2245-stable/ -rw-r--r-- 0 fries2 38282 222 Sep 21 13:45 x264-snapshot-20150921-2245-stable/._.gitignore -rw-r--r-- 0 fries2 38282 364 Sep 21 13:45 x264-snapshot-20150921-2245-stable/.gitignore -rw-r--r-- 0 fries2 38282 222 Sep 21 13:45 x264-snapshot-20150921-2245-stable/._AUTHORS -rw-r--r-- 0 fries2 382822000 Sep 21 13:45 x264-snapshot-20150921-2245-stable/AUTHORS -rwxr-xr-x 0 fries2 38282 222 Sep 21 13:45 x264-snapshot-20150921-2245-stable/._common This makes CMake untag the project with one additional directory in version 3.2 and higher Additional Information: cmake module: SOURCE_DIR ${x264_source} see: https://github.com/UV-CDAT/uvcdat/blob/master/CMake/cdat_modules/x264_external.cmake == Issue History Date ModifiedUsername FieldChange == 2015-10-05 20:39 Charles DoutriauxNew Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] Add more options for NSIS installer artwork
Hi cmake-developers, (first of all, this is my first patch submission, so guidance is appreciated, thanks). I sent a similar patch as plain text in an email to the list last Friday, but after observing the email traffic It looks like you prefer attachments. I also added documentation to this one. The spirit of the change is to expose the NSIS option for bitmap artwork that is used for the left side of the windows installer/uninstaller (documented here: http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html). It really allows the user to make the installer generated by cpack a lot nicer looking than the default. Any and all feedback welcome! Thanks, -Colin --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- 0001-add-options-to-set-the-bitmap-for-NSIS-installer-lef.patch Description: 0001-add-options-to-set-the-bitmap-for-NSIS-installer-lef.patch -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] script mode current directory
Here is the patch which documents and tests those 4 variables in script mode, based on master: --- >From f1a6f5e258321317a8086d0538e0a3240d980731 Mon Sep 17 00:00:00 2001 From: Tamas Kenez Date: Mon, 5 Oct 2015 22:12:30 +0200 Subject: [PATCH] Document and test CMAKE_[CURRENT_](BINARY|SOURCE)_DIR in script mode --- Help/variable/CMAKE_BINARY_DIR.rst | 5 + Help/variable/CMAKE_CURRENT_BINARY_DIR.rst | 5 + Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst | 8 Help/variable/CMAKE_SOURCE_DIR.rst | 8 Tests/RunCMake/CommandLine/P_working-dir.cmake | 14 ++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 5 + 6 files changed, 45 insertions(+) create mode 100644 Tests/RunCMake/CommandLine/P_working-dir.cmake diff --git a/Help/variable/CMAKE_BINARY_DIR.rst b/Help/variable/CMAKE_BINARY_DIR.rst index f8dd8ab..3b323b7 100644 --- a/Help/variable/CMAKE_BINARY_DIR.rst +++ b/Help/variable/CMAKE_BINARY_DIR.rst @@ -6,3 +6,8 @@ The path to the top level of the build tree. This is the full path to the top level of the current CMake build tree. For an in-source build, this would be the same as :variable:`CMAKE_SOURCE_DIR`. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst b/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst index cc3b639..40496b5 100644 --- a/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst +++ b/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst @@ -8,3 +8,8 @@ processed by cmake. Each directory added by :command:`add_subdirectory` will create a binary directory in the build tree, and as it is being processed this variable will be set. For in-source builds this is the current source directory being processed. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst b/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst index db063a4..728291e 100644 --- a/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst +++ b/Help/variable/CMAKE_CURRENT_SOURCE_DIR.rst @@ -5,3 +5,11 @@ The path to the source directory currently being processed. This the full path to the source directory that is currently being processed by cmake. + +When run in -P script mode, CMake sets this variable to the current +working directory. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Help/variable/CMAKE_SOURCE_DIR.rst b/Help/variable/CMAKE_SOURCE_DIR.rst index 3df0226..3644bbb 100644 --- a/Help/variable/CMAKE_SOURCE_DIR.rst +++ b/Help/variable/CMAKE_SOURCE_DIR.rst @@ -6,3 +6,11 @@ The path to the top level of the source tree. This is the full path to the top level of the current CMake source tree. For an in-source build, this would be the same as :variable:`CMAKE_BINARY_DIR`. + +When run in -P script mode, CMake sets this variable to the current +working directory. + +When run in -P script mode, CMake sets the variables +:variable:`CMAKE_BINARY_DIR`, :variable:`CMAKE_SOURCE_DIR`, +:variable:`CMAKE_CURRENT_BINARY_DIR` and +:variable:`CMAKE_CURRENT_SOURCE_DIR` to the current working directory. diff --git a/Tests/RunCMake/CommandLine/P_working-dir.cmake b/Tests/RunCMake/CommandLine/P_working-dir.cmake new file mode 100644 index 000..4ea0293 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_working-dir.cmake @@ -0,0 +1,14 @@ +if(NOT IS_DIRECTORY "${EXPECTED_WORKING_DIR}") + message(FATAL_ERROR "EXPECTED_WORKING_DIR is not a directory: ${EXPECTED_WORKING_DIR}") +endif() + +foreach(d CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR) + if(NOT DEFINED ${d}) +message(FATAL_ERROR "${d} is not defined") + endif() + if(EXPECTED_WORKING_DIR STREQUAL "${${d}}") +message(STATUS "${d} is the expected working directory (${EXPECTED_WORKING_DIR})") + else() +message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})") + endif() +endforeach() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index cef6368..3cc9225 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -22,6 +22,11 @@ run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/P_working-dir-
Re: [cmake-developers] Rename suffix of Mac OS Framework
On 10/01/2015 04:07 AM, Roman Wüger wrote: > set_target_properties(${PROJECT_NAME} PROPERTIES FRAMEWORK TRUE) > > Is there a way to rename the suffix ".framework"? Not currently. It is hard-coded here: https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGeneratorTarget.cxx;hb=679a5d21#l2981 What is the use case for changing the framework extension? Doing so breaks the basic layout defined in "man ld": -framework name[,suffix] This option tells the linker to search for `name.frame- work/name' the framework search path. If the optional suffix is specified the framework is first searched for the name with the suffix and then without (e.g. look for `name.framework/name_suffix' first, if not there try `name.framework/name'). -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Issue on CMAKE_OSX_SYSROOT
On 10/03/2015 05:00 AM, Francesco Romano wrote: > I don't know if this is the right mailing list This is a good place since it concerns a new OS X release. > I needed to set the variable `CMAKE_OSX_DEPLOYMENT_TARGET` to 10.10 and this > was done after the first "project" call. That should be right, though I cannot say for sure without seeing the code. Typically we do not have the project code set this value but instead add it to the CMake command line when building for deployment: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 > elseif("${CMAKE_GENERATOR}" MATCHES Xcode >OR CMAKE_OSX_DEPLOYMENT_TARGET >OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]" >OR NOT EXISTS "/usr/include/sys/types.h") > > Now, the question is: why the Unix Makefile should not need the > variable "CMAKE_OSX_SYSROOT" but only if the deployment target is not set? > Shouldn't be correct to set anyway the sysroot (which by the way can be > easily found because Xcode is present on the machine)? The Unix Makefiles generator also supports the Xcode command-line tools, third-party compilers, etc. that all build for the host system. If you are explicitly building for deployment then you should specify -DCMAKE_OSX_SYSROOT=/path/to/10.10/SDK The Xcode generator searches for a sysroot even when not using an explicit deployment target because Xcode always wants one specified and does not support the pure command-line tools. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [Patch] Adding Windows 10 Universal app support
On 10/02/2015 03:07 PM, Gilles Khouzam wrote: > This patch adds Windows Universal (store) app support. Thanks. I think mapping version "10.0" with no further components to the latest SDK is a good idea not just for universal apps but also for desktop. I split that out into a separate change: VS: Select latest Windows 10 SDK if no specific version was requested https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45812111 Then I split the rest of the changes up into a few more commits: VS: Select Windows 10 Store SDK and toolset for VS 2015 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1b87d72 MSVC: Add system libs for WindowsStore on VS 2015 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c426183 VS: Refactor indentation of LinkLibraryDependencies https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2798dbda VS: Add support for Windows 10 Universal (Store) Applications https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1be2f12c Finally I updated a bit more documentation: Help: Document Windows 10 Universal Applications in cmake-toolchains(7) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2402bb8c This is all now in 'master' and in the 'release' branch for 3.4. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [Patch] Updated FindMatlab.cmake for Matlab R2015b
On 10/03/2015 04:51 AM, Francesco Romano wrote: > Added support to Matlab 8.6 (R2015b) Applied, thanks: FindMatlab: Add support for Matlab R2015b https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2775768f -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] CMake 3.4 feature freeze on 2015-10-01
On 10/01/2015 12:54 PM, Brad King wrote: > I'll announce when post-3.4 development in 'next' is open. I've branched 'release' for 3.4. The repository is now open for post-3.4 development. Please rebase any open topics on 'master' before merging to 'next'. > * Documentation updates > * Regression fixes > * Fixes for bugs in features new to 3.4 These types of changes may still be accepted to 'release' during the 3.4 release candidate cycle. The 3.4 release is now closed to new features and general bug fixes. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [CMake 0015769]: Change of CMakeLists.txt doesn't trigger reconfigure
The following issue has been SUBMITTED. == https://public.kitware.com/Bug/view.php?id=15769 == Reported By:Ruslan Baratov Assigned To: == Project:CMake Issue ID: 15769 Category: CMake Reproducibility:always Severity: minor Priority: normal Status: new == Date Submitted: 2015-10-05 10:37 EDT Last Modified: 2015-10-05 10:37 EDT == Summary:Change of CMakeLists.txt doesn't trigger reconfigure Description: `cmake --build` command doesn't trigger reconfiguration of the project on OS X when CMakeLists.txt changed. Example: add_executable(foo foo.cpp) # file foo.cpp exists cmake -H. -B_builds cmake --build _builds # OK change: add_executable(foo foo.cpp boo.cpp) # file boo.cpp not exists cmake --build _builds # expected error, but no error reported Ready-to-run example can be found: https://github.com/forexample/cmake-osx-no-reconfigure-bug Log from OS X machine: * https://travis-ci.org/forexample/cmake-osx-no-reconfigure-bug/builds/83701171 Log for similar test on Linux machine: * https://travis-ci.org/forexample/cmake-osx-no-reconfigure-bug/builds/83702953 CMake on Linux machine run reconfigure command and report an error: cmake -H. -B_builds --check-build-system CMakeFiles/Makefile.cmake 0 -- Configuring done CMake Error at CMakeLists.txt:4 (add_executable): Cannot find source file: boo.cpp same error expected on OS X machine == Issue History Date ModifiedUsername FieldChange == 2015-10-05 10:37 Ruslan Baratov New Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [Patch] Updated FindMatlab.cmake for Matlab R2015b
Thanks, I think Brad already applied your patch (so thanks Brad!) Best, Raffi > On 03 Oct 2015, at 10:51, Francesco Romano > wrote: > > Added support to Matlab 8.6 (R2015b) > > Attached is the patch. > > > <0001-Updated-FindMatlab.cmake-to-find-Matlab-R2015b.patch> > > Thank you > Francesco-- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake-developers -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [CMake 0015768]: install command does not install symbolic link for a versioned shared library
The following issue has been SUBMITTED. == https://public.kitware.com/Bug/view.php?id=15768 == Reported By:Francis ANDRE Assigned To: == Project:CMake Issue ID: 15768 Category: CMake Reproducibility:always Severity: minor Priority: normal Status: new == Date Submitted: 2015-10-05 10:13 EDT Last Modified: 2015-10-05 10:13 EDT == Summary:install command does not install symbolic link for a versioned shared library Description: Hi This command install( TARGETS "${target_name}" EXPORT "${target_name}Targets" LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin INCLUDES DESTINATION include ) install the lib shared library with a symbolic link on Linux while it does not install a symbolic link on the archive on Cygwin, neither he does install a symbolic link on the runtime destination Steps to Reproduce: 1/ Build a shared library on Cygwin 2/ install it 3/ No symbolic link are defined for the archive library, nor for the shared library. == Issue History Date ModifiedUsername FieldChange == 2015-10-05 10:13 Francis ANDRE New Issue == -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] added get_git_revision and get_git_branch commands as follow-up to cm...@cmake.org
Hi Daniel I just wanted to let you know that I was planing to bring a git versioning script upstream soon. It is based on the following sequence of commands: https://github.com/bufferoverflow/proxyme/blob/master/CMakeLists.txt#L5 It tries to generate a version string of the following form: {git-tag} ({git-hash}-{dirty}). It will try to do the best possible to figure out the tag: -If on a valid tag: v1.1.0 (f567657) -If no tag but clean workdir: undefined (f567657) -If not tag and working tree with uncommited changes: undefined (f567657-dirty) This -dirty convention is the same as used by u-boot and the linux kernel. Maybe you can incorperate these ideas into your solution too. Regards Pascal Am 05.10.2015 um 12:50 schrieb Daniel Wirtz: > Hey all, > > thanks for the feedback, i've included most of it. > > Regarding the configure/build issue: that indeed is inconvenient and may > cause irritation. on the other side, if there has been git activity fussing > with any source files affecting the build, cmake will run again and hence > capture the possibly new git info. so the case where you change the revision > after configure to an extent where cmake will not automatically re-run is > uncommon, at least for my guessing. > however, i've included an explicit warning in the docs to raise awareness. > > i'm happy to provide a suitable procedure that is flexible enough; providing > scripts that configure files (like with sprokit) seems too specific as people > might want to have a single "config.h" file or so containing more than just > the git info. > i've thought about the possibility to generate an explicit "git_version.h" > file to include, but that 1) restricts possible languages and 2) will require > an extra build target that is run each build etc. any thoughts? > > Daniel > > Signed-off-by: Daniel Wirtz > --- > Modules/FindGit.cmake | 145 > +++--- > 1 file changed, 138 insertions(+), 7 deletions(-) > > diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake > index b4f7b4b..e8a86f5 100644 > --- a/Modules/FindGit.cmake > +++ b/Modules/FindGit.cmake > @@ -2,28 +2,75 @@ > # FindGit > # --- > # > +# This module helps finding a local Git_ installation and provides > convenience functions for common Git queries. > # > +# .. _Git: http://git-scm.com/ > # > -# The module defines the following variables: > +# Defined variables > +# " > # > -# :: > +# :variable:`GIT_EXECUTABLE` > +#Path to Git_ command line client > +# :variable:`GIT_FOUND` > +#True if the Git_ command line client was found > +# :variable:`GIT_VERSION_STRING` > +#The version of Git_ found (since CMake 2.8.8) > +# > +# Defined functions > +# " > +# > +# For convenience, the module provides the additional functions > +# > +# :command:`git_get_revision` > +# Get commit revision number information. +# > +# :command:`git_get_branch` +# Get current branch information. > # > -#GIT_EXECUTABLE - path to git command line client > -#GIT_FOUND - true if the command line client was found > -#GIT_VERSION_STRING - the version of git found (since CMake 2.8.8) > +# **WARNING** > # > -# Example usage: > +# If you use those functions at *configure* time and checkout a different > Git_ revision after running :manual:`cmake(1)`, > +# the information from :command:`git_get_revision` or > :command:`git_get_branch` will be outdated. > +# If you need to be sure, we recommend using :command:`add_custom_command` > or :command:`add_custom_target` in conjunction with > +# the :manual:`cmake(1)` script mode (:code:`-P`) to ensure the Git_ > information is obtained at *build* time. +# +# > +# Example usage > +# " > # > # :: > # > #find_package(Git) > #if(GIT_FOUND) > # message("git found: ${GIT_EXECUTABLE}") > +# git_get_branch(GITBRANCH) > +# message("current branch at ${CMAKE_CURRENT_SOURCE_DIR}: ${GITBRANCH}") > #endif() > +# > +# Details > +# """ > +# > +# .. variable:: GIT_EXECUTABLE > +# > +#Returns the full path to the Git_ executable to use in e.g. > :command:`add_custom_command` like > +# > +# :: > +# > +#add_custom_command(COMMAND ${GIT_EXECUTABLE} clone > https://github.com/myrepo mydir) > +#+# .. variable:: GIT_FOUND > +# > +#Boolean variable set to TRUE if a local Git_ was found, FALSE else. > +# +# .. variable:: GIT_VERSION_STRING > +# > +#The output of :code:`git --version` > + > > #= > # Copyright 2010 Kitware, Inc. > # Copyright 2012 Rolf Eike Beer > +# Copyright 2015 Daniel Wirtz > # > # Distributed under the OSI-approved BSD License (the "License"); > # see accompanying file Copyright.txt for details. > @@ -73,7 +120,91 @@ endif() > # Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if > # all listed variables are TRUE > -
Re: [cmake-developers] added get_git_revision and get_git_branch commands as follow-up to cm...@cmake.org
+endif() +set(${VARNAME} ${RES} PARENT_SCOPE) +endfunction() \ No newline at end of file Bug ;) -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] added get_git_revision and get_git_branch commands as follow-up to cm...@cmake.org
Hey all, thanks for the feedback, i've included most of it. Regarding the configure/build issue: that indeed is inconvenient and may cause irritation. on the other side, if there has been git activity fussing with any source files affecting the build, cmake will run again and hence capture the possibly new git info. so the case where you change the revision after configure to an extent where cmake will not automatically re-run is uncommon, at least for my guessing. however, i've included an explicit warning in the docs to raise awareness. i'm happy to provide a suitable procedure that is flexible enough; providing scripts that configure files (like with sprokit) seems too specific as people might want to have a single "config.h" file or so containing more than just the git info. i've thought about the possibility to generate an explicit "git_version.h" file to include, but that 1) restricts possible languages and 2) will require an extra build target that is run each build etc. any thoughts? Daniel Signed-off-by: Daniel Wirtz --- Modules/FindGit.cmake | 145 +++--- 1 file changed, 138 insertions(+), 7 deletions(-) diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index b4f7b4b..e8a86f5 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -2,28 +2,75 @@ # FindGit # --- # +# This module helps finding a local Git_ installation and provides convenience functions for common Git queries. # +# .. _Git: http://git-scm.com/ # -# The module defines the following variables: +# Defined variables +# " # -# :: +# :variable:`GIT_EXECUTABLE` +#Path to Git_ command line client +# :variable:`GIT_FOUND` +#True if the Git_ command line client was found +# :variable:`GIT_VERSION_STRING` +#The version of Git_ found (since CMake 2.8.8) +# +# Defined functions +# " +# +# For convenience, the module provides the additional functions +# +# :command:`git_get_revision` +# Get commit revision number information. +# +# :command:`git_get_branch` +# Get current branch information. # -#GIT_EXECUTABLE - path to git command line client -#GIT_FOUND - true if the command line client was found -#GIT_VERSION_STRING - the version of git found (since CMake 2.8.8) +# **WARNING** # -# Example usage: +# If you use those functions at *configure* time and checkout a different Git_ revision after running :manual:`cmake(1)`, +# the information from :command:`git_get_revision` or :command:`git_get_branch` will be outdated. +# If you need to be sure, we recommend using :command:`add_custom_command` or :command:`add_custom_target` in conjunction with +# the :manual:`cmake(1)` script mode (:code:`-P`) to ensure the Git_ information is obtained at *build* time. +# +# +# Example usage +# " # # :: # #find_package(Git) #if(GIT_FOUND) # message("git found: ${GIT_EXECUTABLE}") +# git_get_branch(GITBRANCH) +# message("current branch at ${CMAKE_CURRENT_SOURCE_DIR}: ${GITBRANCH}") #endif() +# +# Details +# """ +# +# .. variable:: GIT_EXECUTABLE +# +#Returns the full path to the Git_ executable to use in e.g. :command:`add_custom_command` like +# +# :: +# +#add_custom_command(COMMAND ${GIT_EXECUTABLE} clone https://github.com/myrepo mydir) +#+# .. variable:: GIT_FOUND +# +#Boolean variable set to TRUE if a local Git_ was found, FALSE else. +# +# .. variable:: GIT_VERSION_STRING +# +#The output of :code:`git --version` + #= # Copyright 2010 Kitware, Inc. # Copyright 2012 Rolf Eike Beer +# Copyright 2015 Daniel Wirtz # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -73,7 +120,91 @@ endif() # Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if # all listed variables are TRUE -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Git REQUIRED_VARS GIT_EXECUTABLE VERSION_VAR GIT_VERSION_STRING) + +# Convenience Git repo & branch information functions + +#.rst: +# .. command:: git_get_revision +# +# :: +# +# git_get_revision(VARNAME +#[SHORT] +#[GIT_OPTIONS] +#[WORKING_DIRECTORY] ) +# +# Obtain Git_ revision information using the rev-parse_ command. Effectively calls :code:`rev-parse [GIT_OPTIONS] --verify -q HEAD`. +# +# ``VARNAME`` +#The workspace variable name to assign the result to. +# +# ``SHORT`` +#Optional. If set to TRUE, the short revision string will be returned. Otherwise, the full revision hash is returned. +# +# ``GIT_OPTIONS`` +#Optional. Specify a string like :code:`"--sq"` to add to the options of the rev-parse_ command. +# +