[英]Why am I getting Error Cannot find source file in cmake?
I am trying to create a shared library using the files present in SOURCE. 我正在尝试使用SOURCE中的文件创建共享库。 So I added as suggested by this post .
所以我按照这篇文章的建议添加了。
cmake_minimum_required(VERSION 3.0.2)
project(myproj)
set (SOURCE
${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/src/io/IO1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/io/IO2.cpp
)
add_library(myprojlib SHARED SOURCE)
I get error even though I have set the source : 即使我设置了源代码,我也会收到错误:
CMake Error at CMakeLists.txt:34 (add_library): Cannot find source file:
CMakeLists.txt上的CMake错误:34(add_library):找不到源文件:
SOURCE
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
尝试扩展.c .C .c ++ .cc .cpp .cxx .m .M .mm .h .hh .h ++ .hm .hpp .hxx .in .txx
add_library(myprojlib SHARED SOURCE)
should be add_library(myprojlib SHARED ${SOURCE})
CMake
expects that you mean SOURCE is the filename of your source cdoe not a CMake
variable. add_library(myprojlib SHARED SOURCE)
应该是add_library(myprojlib SHARED ${SOURCE})
CMake
希望你的意思是SOURCE是源cdoe的文件名而不是CMake
变量。 The ${} syntax makes it clear that SOURCE is a CMake variable. $ {}语法清楚地表明SOURCE是一个CMake变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.