[CMake] install(DIRECTORY . DESTINATION include/proj FILES_MATCHINGPATTERN "*.h")
Tyler Roscoe
tyler at cryptio.net
Wed Oct 28 14:38:27 EDT 2009
On Wed, Oct 28, 2009 at 02:32:22PM -0400, David Cole wrote:
> You are touching an existing header file...
>
> What happens if you add a new header file that was not there the first time
> you ran make install?
Sorry, I left out the part where I cleaned up and switched to the other
CMakeLists in my copy-pasting.
[tylermr at alta:~/install-dir-vs-file-glob-test/b]$ ls ../include/
foo.h
[tylermr at alta:~/install-dir-vs-file-glob-test/b]$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to:
/alta/tylermr/install-dir-vs-file-glob-test/b
[tylermr at alta:~/install-dir-vs-file-glob-test/b]$ make install
Install the project...
-- Install configuration: ""
-- Installing: /tmp/install.test.tmr/include/include
-- Installing: /tmp/install.test.tmr/include/include/foo.h
[tylermr at alta:~/install-dir-vs-file-glob-test/b]$ touch ../include/bar.h
[tylermr at alta:~/install-dir-vs-file-glob-test/b]$ make install
Install the project...
-- Install configuration: ""
-- Installing: /tmp/install.test.tmr/include/include
-- Up-to-date: /tmp/install.test.tmr/include/include/foo.h
-- Installing: /tmp/install.test.tmr/include/include/bar.h
tyler
> On Wed, Oct 28, 2009 at 2:26 PM, Tyler Roscoe <tyler at cryptio.net> wrote:
>
> > On Wed, Oct 28, 2009 at 01:18:55PM -0400, David Cole wrote:
> > > Except: that argument is not valid in this case. Neither file(GLOB nor
> > > install(DIRECTORY will "rerun" anything if a new header file is added
> > into
> > > the directory...
> >
> > David I don't think this is correct.
> >
> > Here's a test using file(GLOB) + install(FILES):
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ cat ../CMakeLists.txt
> > cmake_minimum_required(VERSION 2.6)
> > project (test)
> >
> > set (CMAKE_INSTALL_PREFIX "/tmp/install.test.tmr")
> >
> > file (GLOB header_files "include/*.h")
> > install (FILES ${header_files} DESTINATION include)
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ cmake ..
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to:
> > /alta/tylermr/install-dir-vs-file-glob-test/b
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ make install
> > Install the project...
> > -- Install configuration: ""
> > -- Installing: /tmp/install.test.tmr/include/foo.h
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ touch
> > ../include/bar.h
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ make install
> > Install the project...
> > -- Install configuration: ""
> > -- Up-to-date: /tmp/install.test.tmr/include/foo.h
> >
> >
> > Note that CMake does not notice the addition of bar.h.
> >
> >
> > Here's a test using install(DIRECTORY):
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ cat ../CMakeLists.txt
> > cmake_minimum_required(VERSION 2.6)
> > project (test)
> >
> > set (CMAKE_INSTALL_PREFIX "/tmp/install.test.tmr")
> >
> > install (DIRECTORY include DESTINATION include)
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ make install
> > Install the project...
> > -- Install configuration: ""
> > -- Installing: /tmp/install.test.tmr/include/include
> > -- Installing: /tmp/install.test.tmr/include/include/foo.h
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ touch
> > ../include/bar.h
> >
> > [tylermr at alta:~/install-dir-vs-file-glob-test/b]$ make install
> > Install the project...
> > -- Install configuration: ""
> > -- Installing: /tmp/install.test.tmr/include/include
> > -- Up-to-date: /tmp/install.test.tmr/include/include/foo.h
> > -- Installing: /tmp/install.test.tmr/include/include/bar.h
> >
> >
> > Note that bar.h is noticed and installed.
> >
> >
> > tyler
> >
More information about the CMake
mailing list