CMake install() isn't supported?
I cannot seem to get install working correctly as well as packaging a deployable release. Bellow is my CMake file example for installation:-------------------------------------
project(exe1)
set(${PROJECT_NAME}_headers "")
set(${PROJECT_NAME}_sources main.cpp)
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_headers} ${${PROJECT_NAME}_sources})
target_link_libraries(${PROJECT_NAME} dll1)
# IS THIS NOT SUPPORTED BY CLION?
# ---------------------------------
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)
-------------------------------------
If it is supported how do I go about running the build process
to create these directories and store the appropriate files within them.
Please sign in to leave a comment.
Hi Justin.
We have the issue in the tracker: https://youtrack.jetbrains.com/issue/CPP-838
Feel free to comment or upvote.
Does the workaround with using an external tool help you?
Hi Anna I'm not sure how I would use the external tool in this case. Could you or someone please explain to me how
I would go about setting it up so the binaries are installed as so?
./bin/example.exe
./bin/exampledll.dll
./bin/lib/static/examplelilb.lib
./bin/lib/static/exampledll.lib
Justin, sorry for the late response. The workaround in this case is to use make install as an External tool. To make it please do the following
install(TARGETS <list-of-your-target's-names>RUNTIME DESTINATION ${CMAKE_SOURCE_DIR}/bin
LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/libARCHIVE DESTINATION ${CMAKE_SOURCE_DIR}/lib/static)I know that this workaround may seem confusing at the first time, feel free to vote for the issue mentioned above to get it fixed soon.
Attachment(s):
Screen Shot 2015-09-18 at 01.35.00.png
Thank you, it seems to be a good-enough-in-the-short-term workaround, albeit a quite convoluted and not scaleable. Surprising that no progress seem to have been made on this in a year.
One simple way to make life easier would be to allow CMAKE variables (assuming CLion has the needed visibility) in the Working Directory field.
Up-voted CPP-838.