[CMake] Do build after GIT_TAG changed in ExternalProject_Add

David Cole DLRdave at aol.com
Mon Apr 20 07:21:11 EDT 2015


I am using Visual Studio 2013 with Update 4 installed, and the very
latest CMake v3.2.2 on my Windows machine. I cannot reproduce your
problem, and include here the complete steps I used while trying.
Anybody should be able to run configure.cmd and build.cmd as follows
and reproduce the correct behavior with CMake 3.2.2 -- let me know if
you try this yourself and something doesn't work...

I modified your CMakeLists as follows (because I know the SmallAndFast
repo builds quite quickly on many different systems, and is easy to
test with):

# ----------------------------------------------------------------------
# CMakeLists.txt

cmake_minimum_required(VERSION 3.2)
project(repro NONE)

include(ExternalProject)

ExternalProject_Add(name
    GIT_REPOSITORY https://github.com/dlrdave/SmallAndFast.git
    GIT_TAG 68c3cebf842aa8a13d659fec428fd85ca3a24307
    CMAKE_ARGS ""
    INSTALL_COMMAND ""
)

# Possible commits in this repo (most recent first)
#
#  68c3cebf842aa8a13d659fec428fd85ca3a24307
#  a0acdce3a549796ca4424c591c038eeb19e59a72
#  5e98e304a464946dd34cb4c53eb3dd1fd348781b
#  8ea36ce26a6b00ab839064a6066a984f6d6647f6

# END CMakeLists.txt


Then I wrote two wrapper scripts configure.cmd and build.cmd so you
can see exactly how I execute the steps for building the code. Put all
three files in the same initially empty directory to test it yourself.
You can run configure.cmd exactly once, and then just run build.cmd
over and over again.

@rem -------------------------------------------------------------------
@rem configure.cmd
@echo off
set cmake_exe=C:\Program Files (x86)\CMake\bin\cmake.exe

pushd "%~dp0"

if exist ".\build" rmdir /s /q build
mkdir build

pushd build
"%cmake_exe%" -G "Visual Studio 12 2013" ..
popd

popd

echo Now run build.cmd...
pause
@rem END configure.cmd


@rem -------------------------------------------------------------------
@rem build.cmd
@echo off
set cmake_exe=C:\Program Files (x86)\CMake\bin\cmake.exe

pushd "%~dp0"

if not exist ".\build" echo Run configure.cmd before running
build.cmd&& pause&& exit /b 1

pushd build
"%cmake_exe%" --build . --config Release
popd

popd

pause
@rem END build.cmd


Everytime you run configure.cmd, it will wipe out the "build"
directory and start clean, so you should only run it once at the
beginning...

Now if you run build.cmd after that, you should see the repo cloned
the first time you run it. After that, unless you change the
CMakeLists file, each build should be a "do nothing" build.


If I change the commit hash from the first value to the second value
in between runs of build.cmd, I see output like this:

CustomBuild:
  Performing update step for 'name'
  Previous HEAD position was 68c3ceb... Add more lines of
intentionally warning code
  HEAD is now at a0acdce... Add an intentional memory leak exe and test


If I do not change anything in between runs of build.cmd, I only see
this output:

CustomBuild:
  Performing update step for 'name'


Is this essentially the same as what you're doing? Or are you doing
something differently than this?

Does this help you figure out what's going wrong...?


Hope it helps somehow,
David C.




On Sat, Apr 18, 2015 at 5:58 PM, typ1232 <dummdoof-doof at web.de> wrote:
> I'm using CMake 3.0.2 with the Visual Studio 2013 generator.
>
>
>
> --
> View this message in context: http://cmake.3232098.n2.nabble.com/Do-build-after-GIT-TAG-changed-in-ExternalProject-Add-tp7590299p7590302.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list