[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:       Eric Noulard <eric.noulard () gmail ! com>
Date:       2009-09-10 6:12:43
Message-ID: cbe23c50909092312m25094d0dwdee998971639273d () mail ! gmail ! com
[Download RAW message or body]

2009/9/10 Bob Tanner <tanner@real-time.com>:
> On 2009-09-09 05:53:15 -0500, David Cole <david.cole@kitware.com> said:
>
>> Or just use "install(FILES" -- it already does the "if not exists, if
>> newer
>> than" checks...
>
> INSTALL (
>        FILES ${CMAKE_CURRENT_SOURCE_DIR}/sample_features
>        DESTINATION etc
>        RENAME features
> )

Yes I think you want a different behavior than that.

I think you want:
"Do not install if FILE IS ALREADY THERE"

but I think INSTALL(FILES  do
"Dot not install IF FILE EXISTS OR IS NEWER"

You should try to:

1) put your initial CMake script logic using IF(EXISTS "...
    in a CopyIfNotExists.cmake file

2)  use INSTALL(SCRIPT CopyIfNotExists.cmake)

You may have to write parameterized CopyIfNotExists.cmake.in which
configured using CONFIGURE_FILE because CopyIfNotExists.cmake
will be executed at install time with no variables coming from your
CMakeLists.txt defined.

So the most general way may be :

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)

Should makes it possible to run any CMake scripts at install time.
Note however that in the CopyIfNotExists.cmake[.in] scripts you are
in CMake scripting mode (the one used when CMake -P) so you
may not use INSTALL command inside that one
(anyone correct me if I'm wrong)
but you already did that using the "cmake -E copy"


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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