On Thu, Oct 13, 2011 at 3:47 PM, Michael Hertling <mhertl...@online.de>wrote:

> You might use an installation component for the concerned headers:
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
> PROJECT(INSTCOMP C)
> SET(CMAKE_VERBOSE_MAKEFILE ON)
> SET(F_PREFIX "/dev/shm" CACHE PATH "")
> FILE(WRITE ${CMAKE_BINARY_DIR}/f.h "void f(void);\n")
> INSTALL(FILES ${CMAKE_BINARY_DIR}/f.h
>    DESTINATION ${F_PREFIX}/include
>    COMPONENT f)
> ADD_CUSTOM_TARGET(f_install
>    ${CMAKE_COMMAND} -DCOMPONENT=f -P cmake_install.cmake)
> FILE(WRITE ${CMAKE_BINARY_DIR}/main.c
> "#include <${F_PREFIX}/include/f.h>
> int main(void){return 0;}
> ")
> ADD_EXECUTABLE(main main.c)
> ADD_DEPENDENCIES(main f_install)
>
> The f.h header is selectively installed via the f_install custom
> target, and due to the main-on-f_install dependency, it will be
> installed before the main target is built.


Thanks for the info.

After I posted I found out about file( COPY ) and used that instead.
--

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

Reply via email to