[CMake] cmake cannot find source file (new to cmake)
Cao, Lei
leicao88124 at lanl.gov
Wed Dec 19 18:31:15 EST 2018
Hi,
I tried to follow some examples and wrote some cmake files to build my code. But cmake is complaining that it cannot find a source file. Here is the code structure:
Toplevel
|----- CMakeLists.txt
|----- src --------|------CMakeLists.txt
| |------common---------------|-------CMakeLists.txt
| |------dir1-----| |------- src1.h
| |-----CMakeLists.txt
|----bin |-----src2.c
|-----src3.c
Here is the CMakeLists.txt in toplevel:
project(proj)
add_subdirectory(src)
Here is the CMakeLists.txt in src:
project(proj)
add_subdirectory(common)
add_subdirectory(dir1)
include_directories(common)
set(src_files src1.h src2.c src3.c)
add_executable(exec ${src_files})
CMakeLists.txt in common and dir1 are empty.
When I ran "cmake .." in bin, cmake complained that it could not find source file src1.h in add_executable. What is wrong here?
Thanks,
Lei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181219/02f79445/attachment.html>
More information about the CMake
mailing list