[CMake] Automated packaging

Alexander Neundorf a.neundorf-work at gmx.net
Thu Oct 15 12:28:28 EDT 2009


On Wednesday 14 October 2009, Dixon, Shane wrote:
> Eric,
>
> I'm trying your idea and I feel like I'm so close to a solution.  Here's
> the call:
>
> EXECUTE_PROCESS(
> 	WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
> 	COMMAND ${CTEST_CMAKE_COMMAND}
>      -DCTEST_BINARY_DIRECTORY:STRING="${CTEST_BINARY_DIRECTORY}"
>      -DCTEST_CMAKE_COMMAND:STRING="${CTEST_CMAKE_COMMAND}"
>      -DPACKAGE_ARCHIVE:STRING="${PACKAGE_ARCHIVE}"
>      -P ${CTEST_SOURCE_DIRECTORY}/cmake/CopyToArchive.cmake
> 	RESULT_VARIABLE copy_result )
>
> EXECUTE_PROCESS(
> 	WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
> 	COMMAND ${CTEST_CMAKE_COMMAND}
> 	-E echo "copy_result = ${copy_result}" )
>
> Here's the contents of CopyToArchive.cmake:
>
> include(CPackConfig.cmake)
>
> EXECUTE_PROCESS(
> 	WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
> 	COMMAND ${CTEST_CMAKE_COMMAND}
> 	-E echo "CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}" )
>
> EXECUTE_PROCESS(
> 	WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
> 	COMMAND ${CTEST_CMAKE_COMMAND}
> 	-E copy ${CPACK_PACKAGE_FILE_NAME}.exe ${PACKAGE_ARCHIVE}
> 	RESULT_VARIABLE copy_result )
>
> For some reason, I get a "copy_result = 0" which indicates success, but
> then the file is never moved.
>
> If I run the exact same thing manually, it works:
>
> cmake
> -DCTEST_BINARY_DIRECTORY:STRING="C:/temp/ctest_builds/myproj_build_nmake"
> -DCTEST_CMAKE_COMMAND:STRING="cmake"
> -DPACKAGE_ARCHIVE:STRING="c:/temp/ctest_builds/archive" -P
> C:/temp/ctest_builds/myproj/cmake/CopyToArchive.cmake
>
> I'm not sure why this never appears to call.  It should print out the file
> name when it's called and it never does.  When I run by hand, it works
> great.
>
> Why is it that in Ctest this fails?  I'm using Cmake 2.8rc3 so maybe that
> makes a difference.

I would suggest that you put in some MESSAGE() commands and print the 
variables you are interested in. Hopefully this will give a hint.

Alex


More information about the CMake mailing list