[CMake] Re: Install of pattern matched files

Rodolfo Lima rodolfo at rodsoft.org
Fri Dec 28 16:54:57 EST 2007


Brandon Van Every escreveu:

> What version of CMake are you using?  CMake 2.4.7 documentation says
> plenty about this.  INCLUDE(DIRECTORY ... PATTERN blah ...) should
> work fine without an EXCLUDE

I think you've meant INSTALL(...). Documentation says:

"The PATTERN and REGEX options specify a globbing pattern or regular
expression to match directories or files encountered during traversal of
an input directory.
...
Options following one of these matching expressions are applied only to
files or directories matching them. The EXCLUDE option will skip the
matched file or directory. The PERMISSIONS option overrides the
permissions setting for the matched file or directory."

So, pattern/regex are only used to specify which files you want to
exclude or set permissions. Nothing is said about only allowing matching
files to be installed, so the current behaviour is correct, albeit not
ideal.

One testcase is the following:
* tst
	CMakeLists.txt
	* include
		* test
			test.cpp
			test.h
		another.h
	
CMakeLists.txt contains:	
install(DIRECTORY include DESTINATION ${CMAKE_BINARY_DIR}/usr PATTERN "*.h")

After doing a cmake ./make install, we have:
-- Install configuration: ""
-- Installing /home/rodolfo/src/tst/usr/include
-- Installing /home/rodolfo/src/tst/usr/include/test
-- Installing /home/rodolfo/src/tst/usr/include/test/test.cpp
-- Installing /home/rodolfo/src/tst/usr/include/test/test.h
-- Installing /home/rodolfo/src/tst/usr/include/test.h
-- Installing /home/rodolfo/src/tst/usr/include/another.h

The 'test.cpp' gets copied :( And this happens with both cmake-2.4.7 and
cmake-cvs (as of 12/28/2007).


Regards,
rod




More information about the CMake mailing list