<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;"> 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:</span><br>
</p>
<p><br>
</p>
<p> Toplevel</p>
<p> |----- CMakeLists.txt</p>
<p> |----- src --------|------CMakeLists.txt</p>
<p> | |------common---------------|-------CMakeLists.txt</p>
<p> | |------dir1-----| |------- src1.h</p>
<p> | |-----CMakeLists.txt</p>
<p> |----bin |-----src2.c</p>
<p> |-----src3.c</p>
<p><br>
</p>
<p> Here is the CMakeLists.txt in toplevel:</p>
<p> project(proj)</p>
<p> add_subdirectory(src)</p>
<p><br>
</p>
<p><br>
</p>
<p> Here is the CMakeLists.txt in src:</p>
<p> project(proj)</p>
<p> add_subdirectory(common)</p>
<p> add_subdirectory(dir1)</p>
<p> include_directories(common)</p>
<p> set(src_files src1.h src2.c src3.c)</p>
<p> add_executable(exec ${src_files})</p>
<p><br>
</p>
<p> CMakeLists.txt in common and dir1 are empty.</p>
<p><br>
</p>
<p> When I ran "cmake .." in bin, cmake complained that it could not find source file src1.h in add_executable. What is wrong here?</p>
<p><br>
</p>
<p>Thanks,</p>
<p>Lei</p>
</div>
</body>
</html>