2012/11/9 Manoj Vaghela <[email protected]>:
> 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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to