[CMake] Adding external executable
Eric Noulard
eric.noulard at gmail.com
Fri Nov 9 03:54:20 EST 2012
2012/11/9 Manoj Vaghela <manoj.vaghela at gmail.com>:
> Dear Eric,
>
> Thanks for your reply.
>
> When I am using INSTALL (FILES... ) for adding external executable to my
> CMakeLists.txt file, it shows the executable file in the RPM archive. But
> it's execute permission is lost. What should I have to do for that?
>
> Also, ADD_EXECUTABLE( ... IMPORTED) did not work for me. I added this line
> but when archive is created, it did not include my executable in it.
See my comment below:
>
> This is sample of my CMakeLists.txt
> -----------------------------------------------
>
> SET( CPACK_GENERATOR "RPM" )
>
> ##### MAIN EXE
> SET( MAIN_EXE myExe)
> ADD_EXECUTABLE(${MAIN_EXE} SOME_SOURCE_FILES )
> SET( INSTALL_DIR "$ENV{HOME}/MANOJ" )
> INSTALL( TARGETS ${MAIN_EXEC} DESTINATION ${INSTALL_DIR} )
>
> ##### EXTERNAL EXE
> SET( EXTERNAL_EXE "/home/manoj/EXTERNAL/a.out.exe" )
> SET( IMPORTED_LOCATION ${EXTERNAL_EXE} )
> ADD_EXECUTABLE( ${EXTERNAL_EXE} IMPORTED) // This does not pack the
> executable
Once the external executable is imported as a TARGET
you have to install it:
INSTALL( TARGETS ${EXTERNAL_EXE} DESTINATION ${INSTALL_DIR} )
>
> #INSTALL( FILES ${EXTERNAL_EXE} DESTINATION ${INSTALL_DIR}) // This packs,
> but permissions lost
My mistake for executable you should be using
install(PROGRAMS files... DESTINATION <dir>
[PERMISSIONS permissions...]
[CONFIGURATIONS [Debug|Release|...]]
[COMPONENT <component>]
[RENAME <name>] [OPTIONAL])
signature.
--
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
More information about the CMake
mailing list