[CMake] Adding external executable

Manoj Vaghela manoj.vaghela at gmail.com
Fri Nov 9 04:25:07 EST 2012


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121109/6ead2f66/attachment-0001.htm>


More information about the CMake mailing list