CLion and CMake: only building a library without an executable?

橙三吉。 提交于 2019-11-30 06:38:28

问题


How to only build a static library with clion without having an executable? How does the CMakeLists.txt look like? (without add_executable)

Update: If I don't add executable to Clion, I have an error, that an executable is required.

Here my CMakeLists.txt.


回答1:


This is an old question. But I'll add the answer to your question as a help for other people. You need to replace your add_executable with add_library

add_library(target_name source_files)


来源:https://stackoverflow.com/questions/29355937/clion-and-cmake-only-building-a-library-without-an-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!