Re: [CMake] using source files in build directory
Hi, For header files, that's quite a normal thing to do - you just need to add the CMAKE_CURRENT_BINARY_DIR to your include directories. For .cpp files, you can write your target so that it is referencing the source file in the binary directory. I.e.: configure_file( ${CMAKE_CURRENT_SOURCE_DIRECTORY}/file1.cpp.in ${CMAKE_CURRENT_BINARY_DIRECTORY}/file1.cpp COPYONLY) add_executable( target1 ${CMAKE_CURRENT_BINARY_DIRECTORY}/file1.cpp) Is that sufficient for your needs? If you rather need a real wildcard way to override arbitrary source files, then you're probably out of luck. You could still write a wrapper around add_executable and add_library that inspects source directory and binary directory, but that might not be worth the effort... Johannes On Thursday 22 October 2015 15:13:08 Srinath Vadlamani wrote: > Hello All, > I am aware of out-of-source builds. I want to add modified source files > to the out of source build directory and have CMake use these modified > files. > > Below is my example: > $pwd > > $ls > CmakeLists.txt CMake README src tests doc ... > $mkdir build1 > $cd build1 > $cp ../src/file1.cpp . > $ > $ccmake > $make -j N > $ > > Now I want to make another build directory that houses a few other modified > files: > > $cd > $mkdir build2 > $cd build2 > $cp ../src/file1.cpp . && cp ../src/file2.cpp . > $ > $ccmake > $make -j N > $ but file2 mods helped> > > > . and so on. The point is that the build directory allowing for > modified source files helps preserve executables and the dependent source > files for code management. Some may now chime in with opinions on version > control usage, but I'm trying to understand if it is possible to do what I > described and is possible with Autotools. > > Thank you for your time, > <>Srinath > > = > Srinath Vadlamani > = > > On Thu, Oct 22, 2015 at 3:02 PM, Gonzalowrote: > > El 21/10/15 a las 17:45, Srinath Vadlamani escribió: > > > > Hello All, > > > > Is it possible to have CMake use source files in some particular order > > > > that are placed in the out-of-source build directory? This is allows for > > the convenience of having multiple builds in different build directories > > due to a few file changes while preserving the files themselves? > > > > You are aware that you can do out of source builds, right? > > > > $ mkdir build-linux64 > > $ cd build-linux64 > > $ cmake .. # plus any options you want > > $ make > > > > -- > > Gonzalo Garramuñoggarr...@gmail.com -- 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] using source files in build directory
That's really more of a job for source control if you add like if( exists ) for each potential file you want to experiment with it could be done. On Fri, Oct 23, 2015 at 2:07 AM, Johannes Zarl-Zierlwrote: > Hi, > > For header files, that's quite a normal thing to do - you just need to add the > CMAKE_CURRENT_BINARY_DIR to your include directories. > > For .cpp files, you can write your target so that it is referencing the source > file in the binary directory. I.e.: > > configure_file( > ${CMAKE_CURRENT_SOURCE_DIRECTORY}/file1.cpp.in > ${CMAKE_CURRENT_BINARY_DIRECTORY}/file1.cpp COPYONLY) > add_executable( target1 ${CMAKE_CURRENT_BINARY_DIRECTORY}/file1.cpp) > > Is that sufficient for your needs? > > If you rather need a real wildcard way to override arbitrary source files, > then you're probably out of luck. You could still write a wrapper around > add_executable and add_library that inspects source directory and binary > directory, but that might not be worth the effort... > > Johannes > > On Thursday 22 October 2015 15:13:08 Srinath Vadlamani wrote: >> Hello All, >> I am aware of out-of-source builds. I want to add modified source files >> to the out of source build directory and have CMake use these modified >> files. >> >> Below is my example: >> $pwd >> >> $ls >> CmakeLists.txt CMake README src tests doc ... >> $mkdir build1 >> $cd build1 >> $cp ../src/file1.cpp . >> $ >> $ccmake >> $make -j N >> $ >> >> Now I want to make another build directory that houses a few other modified >> files: >> >> $cd >> $mkdir build2 >> $cd build2 >> $cp ../src/file1.cpp . && cp ../src/file2.cpp . >> $ >> $ccmake >> $make -j N >> $> but file2 mods helped> >> >> >> . and so on. The point is that the build directory allowing for >> modified source files helps preserve executables and the dependent source >> files for code management. Some may now chime in with opinions on version >> control usage, but I'm trying to understand if it is possible to do what I >> described and is possible with Autotools. >> >> Thank you for your time, >> <>Srinath >> >> = >> Srinath Vadlamani >> = >> >> On Thu, Oct 22, 2015 at 3:02 PM, Gonzalo wrote: >> > El 21/10/15 a las 17:45, Srinath Vadlamani escribió: >> > >> > Hello All, >> > >> > Is it possible to have CMake use source files in some particular order >> > >> > that are placed in the out-of-source build directory? This is allows for >> > the convenience of having multiple builds in different build directories >> > due to a few file changes while preserving the files themselves? >> > >> > You are aware that you can do out of source builds, right? >> > >> > $ mkdir build-linux64 >> > $ cd build-linux64 >> > $ cmake .. # plus any options you want >> > $ make >> > >> > -- >> > Gonzalo Garramuñoggarr...@gmail.com > > -- > > 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 -- 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] using source files in build directory
El 21/10/15 a las 17:45, Srinath Vadlamani escribió: Hello All, Is it possible to have CMake use source files in some particular order that are placed in the out-of-source build directory? This is allows for the convenience of having multiple builds in different build directories due to a few file changes while preserving the files themselves? You are aware that you can do out of source builds, right? $ mkdir build-linux64 $ cd build-linux64 $ cmake .. # plus any options you want $ make -- Gonzalo Garramuño ggarr...@gmail.com -- 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] using source files in build directory
Hello All, I am aware of out-of-source builds. I want to add modified source files to the out of source build directory and have CMake use these modified files. Below is my example: $pwd $ls CmakeLists.txt CMake README src tests doc ... $mkdir build1 $cd build1 $cp ../src/file1.cpp . $ $ccmake $make -j N $ Now I want to make another build directory that houses a few other modified files: $cd $mkdir build2 $cd build2 $cp ../src/file1.cpp . && cp ../src/file2.cpp . $ $ccmake $make -j N $ . and so on. The point is that the build directory allowing for modified source files helps preserve executables and the dependent source files for code management. Some may now chime in with opinions on version control usage, but I'm trying to understand if it is possible to do what I described and is possible with Autotools. Thank you for your time, <>Srinath = Srinath Vadlamani = On Thu, Oct 22, 2015 at 3:02 PM, Gonzalowrote: > El 21/10/15 a las 17:45, Srinath Vadlamani escribió: > > Hello All, > Is it possible to have CMake use source files in some particular order > that are placed in the out-of-source build directory? This is allows for > the convenience of having multiple builds in different build directories > due to a few file changes while preserving the files themselves? > > You are aware that you can do out of source builds, right? > > $ mkdir build-linux64 > $ cd build-linux64 > $ cmake .. # plus any options you want > $ make > > -- > Gonzalo Garramuñoggarr...@gmail.com > > -- 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] using source files in build directory
Hello All, Is it possible to have CMake use source files in some particular order that are placed in the out-of-source build directory? This is allows for the convenience of having multiple builds in different build directories due to a few file changes while preserving the files themselves? Thanks, <>Srinath = Srinath Vadlamani = -- 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