[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: Re: [CMake] Only install file if it does not exist?
From: Bob Tanner <tanner () real-time ! com>
Date: 2009-09-11 18:36:36
Message-ID: h8e5bj$c16$1 () ger ! gmane ! org
[Download RAW message or body]
On 2009-09-10 01:12:43 -0500, Eric Noulard
<eric.noulard@gmail.com> said:
> 0) Write your parameterized CMake script CopyIfNotExists.cmake.in
>
> 1) CONFIGURE_FILE(CopyIfNotExists.cmake.in CopyIfNotExists.cmake)
> This step will replace appropriate vars in CopyIfNotExists.cmake.in
> with value coming from your current config.
>
> 2) INSTALL(SCRIPT CopyIfNotExists.cmake)
Thank you for your help!
I tried this approach.
CMakeLists.txt
INSTALL (SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/CopyIfNotExists.cmake)
CopyIfNotExists.cmake
MACRO (COPY_IF_NOT_EXISTS _SRC _DEST)
MESSAGE ("Copy ${CMAKE_CURRENT_SOURCE_DIR}/${_SRC} to
${CMAKE_INSTALL_PREFIX}/${_DEST}")
IF (NOT EXISTS ${CMAKE_INSTALL_PREFIX}/${_DEST})
EXECUTE_PROCESS (COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${_SRC}
${CMAKE_INSTALL_PREFIX}/${_DEST})
ENDIF (NOT EXISTS ${CMAKE_INSTALL_PREFIX}/${_DEST})
ENDMACRO (COPY_IF_NOT_EXISTS _SRC _DEST)
COPY_IF_NOT_EXISTS ("sample_features" "etc/features")
The problem is ${CMAKE_CURRENT_SOURCE_DIR} is set to the out-of-source
build directory.
Is this why you said to use a parameterized cmake script?
--
Bob Tanner <tanner@real-time.com> | Phone : (952 943-8700
http://www.real-time.com, Linux, OSX, VMware | Fax : (952)943-8500
Key fingerprint = F785 DDFC CF94 7CE8 AA87 3A9D 3895 26F1 0DDB E378
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic