如何仅使用clion构建静态库而没有可执行文件?
CMakeLists.txt看起来如何? (没有add_executable
)
更新:如果不将可执行文件添加到Clion,则有一个
error,需要一个可执行文件。
这是我的CMakeLists.txt。
最佳答案
这是一个老问题。但我会在您的问题中添加答案,以帮助其他人。您需要将add_executable
替换为add_library
add_library(target_name source_files)
关于cmake - CLion和CMake:仅构建没有可执行文件的库?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29355937/