For Unix system, we always use the command make install to put executables or existing files in the right directory. Cmake uses different variables to identify targets which will be installed.

Target Variable
executables RUNTIME
dynamic link libraries LIBRARY
static link libraries ARCHIVE
macosx_bundle BUNDLE
For install results of building project, relevant syntax:
INSTALL( TARGETS exenames
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
BUNDLE DESTINATION .
)
For install exist files, relevant syntax:
INSTALL( FILES files DESTINATION directory )
We use an old project to show how to use them.

(1) install executable

CMakeLists.txt
set( CMAKE_INSTALL_PREFIX "/usr/local" )
...
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} ${UI_HEADERS} ${QRC_Srcs} )
...
install( TARGETS CMakeTest RUNTIME DESTINATION bin ) # /usr/local/bin BUNDLE

(2) install application

set( CMAKE_INSTALL_PREFIX "/Applications" )
...
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${HEADERS} ${SOURCES} ${UI_HEADERS} ${QRC_Srcs} )
...
install( TARGETS CMakeTest BUNDLE DESTINATION . ) # /usr/local/bin

(3) install files

set( CMAKE_INSTALL_PREFIX "/usr/local" )
...
set( importFiles Untitled.png mainwindow.ui )
install( FILES ${importFiles} DESTINATION share )


0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X
0
Would love your thoughts, please comment.x
()
x