Re: [CMake] add_executable with generated files
On Wed, May 20, 2015 at 3:27 PM, Tom Kacvinsky wrote: > > On Wed, May 20, 2015 at 2:57 PM, Tom Kacvinsky < > tom.kacvin...@vectorcast.com> wrote: > >> I have need to make an executable that depends on a generated file. I've >> read several tutorials on how to do this, but even after following those >> instructions, I get this error: >> >> CMake Error at CMakeLists.txt:436 (add_executable): >> Cannot find source file: >> >> .chop/maint.adb >> >> Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp >> >> has anyone done this, and if so, do you have tips on how to proceed? >> >> Thanks, >> >> Tom >> > > My mistake, the tutorials I looked at were for using generated files in > add_library. I do have a working add_library with generated files, but I > can't seem to get generated files to work with add_executable. So is there > a difference between the two? add_library allows for use of generated > files, but add_executable does not? > > OK, figured something out. If the rule to generate the file is at the same level CMakeLists.txt (or higher) than the CMakeLists.txt that contains the add_executable command which uses the gnerated file, then everything is OK. But if the add_executable is at a higher level than the "rule" that gnerates the file, everything falls apart. This is why my add_library example worked but by add_executable example was not. To confuse the issue even further, I have this setup foo/CMakeLists.txt -> contains macro that uses add_executable foo/vcast/CMakeLists.txt -> contains rule to generate file foo/vcast/progs/CMakeLists.txt -> invokes macro defined at level 1, using the file generated at level 2 Apparently this is enough to thow things off. I though the add_executable would have "occurred" at level 3 as that is where the macro is expanded, but I am guessing cmake expansion of macros doesn't work that way. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] add_executable with generated files
My mistake, the tutorials I looked at were for using generated files in add_library. I do have a working add_library with generated files, but I can't seem to get generated files to work with add_executable. So is there a difference between the two? add_library allows for use of generated files, but add_executable does not? On Wed, May 20, 2015 at 2:57 PM, Tom Kacvinsky wrote: > I have need to make an executable that depends on a generated file. I've > read several tutorials on how to do this, but even after following those > instructions, I get this error: > > CMake Error at CMakeLists.txt:436 (add_executable): > Cannot find source file: > > .chop/maint.adb > > Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp > > has anyone done this, and if so, do you have tips on how to proceed? > > Thanks, > > Tom > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] add_executable with generated files
I have need to make an executable that depends on a generated file. I've read several tutorials on how to do this, but even after following those instructions, I get this error: CMake Error at CMakeLists.txt:436 (add_executable): Cannot find source file: .chop/maint.adb Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp has anyone done this, and if so, do you have tips on how to proceed? Thanks, Tom -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake