How do I get CLion to run an install target

痴心易碎 提交于 2019-11-28 10:54:39

UPDATE: As of 2018.1 EAP, build 181.3741.16, CLion supports running cmake install if your project defines install targets:


Original Answer:

I don't think that CLion implements this feature yet. However, you can work around this limitation by adding a CMake "custom target" (using add_custom_target()) that will execute the make install command:

add_custom_target(install_${PROJECT_NAME}
                  $(MAKE) install
                  DEPENDS ${PROJECT_NAME}
                  COMMENT "Installing ${PROJECT_NAME}")

Now, all you have to do is "build" the install_YOUR_PROJECT_NAME target from the "targets" menu in CLion.

Update:

A more cross-platform technique might be the following:

add_custom_target(install_${PROJECT_NAME}
                  "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target install
                  DEPENDS ${PROJECT_NAME}
                  COMMENT "Installing ${PROJECT_NAME}")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!