[CMake] Use GLOB to generate filelist for install package

Stuermer, Michael SP/HZA-ZSEP michael.stuermer at schaeffler.com
Thu Aug 11 05:29:32 EDT 2016



> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Patrik
> Lehmann
> Sent: Thursday, August 11, 2016 11:04 AM
> To: cmake at cmake.org
> Subject: [CMake] Use GLOB to generate filelist for install package
> 
> Hello,
> 
> I try to use GLOB to collect the files for my install package, but unfortunately I
> got the message
> 
> 'file INSTALL cannot find
> "C:/Project/include/test1.h;C:/Project/include/test2.h;...'
> 
> My code:
> 
> FILE(GLOB MY_INCLUDES_H "${PROJECT_SOURCE_DIR}/include/*.h")
> 
> INSTALL(FILES "${MY_INCLUDES_H}"
>           DESTINATION "include"
>           COMPONENT CPP_INCLUDES)
> 

Remove the '"' around the list of headers in your install command:

INSTALL(FILES ${MY_INCLUDES_H} ...

instead of 

INSTALL(FILES "${MY_INCLUDES_H}" ...

The quotes result in the list to be expanded in only one long string instead of a list of strings. CMake thinks you are only installing one file with a veeeery long name.
 

> 
> Is there a way to collect the files this way or is it needed to add every file
> manually?
> 
> Kind Regards,
> Patrik Lehmann
> --
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list