[CMake] Adding external executable

David Cole david.cole at kitware.com
Fri Nov 9 07:40:53 EST 2012


You should really take Eric's previous advice if you're building a Qt
application:

"A good starting point may be Mike's blog entry on DeployQt4 as well:
http://mikemcquaid.com/2012/01/04/deploying-qt-applications-with-deployqt4/"


On Fri, Nov 9, 2012 at 4:25 AM, Manoj Vaghela <manoj.vaghela at gmail.com> wrote:
> Dear Eric,
>
> Thank you very much for your quick reply.
>
> INSTALL( PROGRAMS ... ) worked fine.
> If I am using this, I also do not need to specify any IMPORTED related
> stuff.
>
> As my understanding now, the following lines are sufficient for creating
> pack.
>
> INSTALL( TARGETS ${EXECUTABLE_NAME} DESTINATION ${INSTALL_DIR} ) // For
> Executable from the current CMakeLists.txt
>
> INSTALL( PROGRAMS ${EXTERNAL_EXE} DESTINATION ${INSTALL_DIR} ) // For
> including external executable in the archive
>
> INSTALL( FILES LIB1 LIB2 DESTINATION ${INSTALL_DIR} ) // For libraries
> (current or external) or any other files
>
> A few clarifications required:
>
> For an application using Qt libraries, should I pack the related Qt
> libraries (QtCore, QtGui, QtOpenGL) ?? or not ?? If I am giving this to
> somebody, I should include them or ask them to install on their machine ?
>
> Also, what is the preferred path or tree for installing package? When RPM is
> installed, will it automatically be included in the $PATH or I have to do it
> someway?
>
> Thanks once again.
>
> --
> regards,
> Manoj
>
> On Fri, Nov 9, 2012 at 2:24 PM, Eric Noulard <eric.noulard at gmail.com> wrote:
>>
>> 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
>
>
>
> --
>
> 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


More information about the CMake mailing list