[CMake] How to set CPACK_SOURCE_IGNORE_FILES to remove all source code?

David Fitzpatrick fitzpatrick at stellarscience.com
Mon Mar 9 17:23:53 EDT 2009


Thanks for the reply Eric,

Let me clarify a few things. By binary distro I was implying an 
installer package without the source code. It is true that my install 
commands do pull in directories that have source code (with INSTALL( 
DIRECTORY bar/) ) and header files (with INSTALL(FILE foo.h)) explicitly 
but I was hoping I could just set the CPACK_SOURCE_IGNORE_FILES variable 
to remove the source files (foo.h and bar/*.c and bar/*.h) . I have not 
been successful in getting this tact to work.

So I ran a quick test setting the ignore value value to
    SET( CPACK_SOURCE_IGNORE_FILES "" )
AND
    SET( CPACK_SOURCE_IGNORE_FILES
        ".*hpp$"
        ".*h$"
        ".*cpp$"
        ".*cxx$"
        ".*c$" )

Saving the CmakeLists.txt file and doing a complete rebuild and cpack... 
ultimately with no difference to the output installer. This all seems so 
simple and perhaps there is a critical piece I am missing but I don't 
understand how both examples above have no effect while I still have an 
installer that extracts many .cpp's and .h's...

 From you comments:
I don't see any documentation or references in the mailing list to: 
CPACK_SOURCE_FILES
What is this? It is currently empty when I print it out at the end of my 
CMakeLists.txt file.

More Info about the install command:
I have a set of applications that are being built with cmake. Each of 
these applications uses a set of common utilities built into a set of 
shared libraries. Each application is basically defined by what set of 
shared libraries it uses. There are multiple developers and the code 
base changes frequently so I overwrote the "TARGET_LINK_LIBRARIES" with 
my own macro that saves the list of dependencies per project/component. 
With this list of dependencies I know what components to include in the 
installer and I set the "CPACK_COMPONENTS_ALL" list to define what is 
installed. I walk this list and call the install command below to get 
all of the source and libs needed for both developers and users. The 
users (for various reasons) cannot have any of the code base and I 
wanted the rule from above to make sure there was none. Adding one 
command to ignore files versus forcing multiple developers to add 
multiple macros/interfaces/loops seemed an easy choice...

-D


Eric Noulard wrote:
> 2009/3/9 David Fitzpatrick <fitzpatrick at stellarscience.com>:
>   
>> I have been working with CMake/CPack (2.6.2 and 2.6.3) for a few weeks now
>> and have run into a problem with creating a binary distro using Cpack and
>> NSIS. I would like to set a flag to remove all source code from the
>> installer and have no success using the CPACK_SOURCE_IGNORE_FILES variable.
>>     
>
> CPACK_SOURCE_IGNORE_FILES is the variables used to ignore files
> usually bundled in "SOURCE package"
>
> if you want to ignore files in a BINARY package you should use
>
> CPACK_SOURCE_FILES
>
>   
>> And I still get files included in the installer...
>>     
>
> try with CPACK_SOURCE_FILES
>
>
>   
>> Is it possible that the install( directory ... ) command and the
>> ignore_files variable do not work together?
>>
>> This is a quick snippit of one of my install() commands that pulls
>> directories:
>>  INSTALL( DIRECTORY
>> "${STELLAR_SANDBOX}/${CPACK_COMPONENT_${componentToInstall}_LOCATION}"
>>   DESTINATION "${CPACK_COMPONENT_${componentToInstall}_LOCATION}/../"
>>   COMPONENT "DevSource"
>>   PATTERN ".svn" EXCLUDE )
>>
>> I know I could glob the different types of source together set the component
>> to "DevSource_h" or the likes and then just not add it to the install_list
>> but that will be allot more work...
>>     
>
> I am a bit puzzled with your INSTALL command...
>
> What are you doing with this?
>
>
>   


More information about the CMake mailing list