user689103
user689103

Reputation: 41

different install Targets with cmake

I have a project consisting of three binaries and two libraries. Today I have 2 CMakeLists.txt files for each part, because I want make install to copy the compiled files to the project/bin directory for development and for production use I want it to install the files to /usr/...

I would like to have a separate make install-dev and make install or something like that. Is that possible with cmake? I searched in the cmake docs but found nothing relevant.

Upvotes: 2

Views: 1293

Answers (1)

ltc
ltc

Reputation: 3361

The easiest way I know of to move the install point is to use relative paths for your install directories

install(TARGETS t tlib
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
)

and then when you run cmake for development run it like this

cmake -D CMAKE_INSTALL_PREFIX=/projhome/bin 

for release like this

cmake -D CMAKE_INSTALL_PREFIX=/usr

Upvotes: 2

Related Questions