![]() And try to express them relative to CMAKE_BINARY_DIR, CMAKE_CURRENT_BINARY_DIR, PROJECT_BINARY_DIR etc. Once you have this working, you can look at where CMake puts things by default, and only if you're not satisfied with the default locations (such as the default value of EXECUTABLE_OUTPUT_PATH), modify only those you need. Then remove all the set() commands and do: cd Compile & rm -rf *Īs long as you're outside of the source directory when running CMake, it will not modify the source directory unless your CMakeList explicitly tells it to do so. Treat these as read-only.įirst remove the existing problematic cache file from the src directory: cd src You should definitely not modify CMAKE_BINARY_DIR or CMAKE_CACHEFILE_DIR. There's little need to set all the variables you're setting. ![]() ![]() You may find it useful to set the paths that binaries, shared and static libraries are written to - in which case see how do I make cmake output into a 'bin' dir? (disclaimer, I have the top voted answer on that question.but that's how I know about it). Unfortunately cmake has usually written a few files by the time the macro is invoked, so although it will stop you from actually performing the build you will still need to delete CMakeCache.txt and CMakeFiles. There are numerous sources for MacroOutOfSourceBuild.cmake on google but I can't seem to find the original and it's short enough to include here in full. The above macro comes from a commonly used module called MacroOutOfSourceBuild. The part where I choose the directory in my CMake script is this: set(dir $ requires an out of source build." Now I moved to another computer, and recompiled CMake 2.8.11.2, and I'm almost back to square one! It always compiles the thing into the src folder where my CMakeLists.txt is located. Where with that I had a clean output in the folder I'm in right now, which is exactly what I'm looking for. ![]() Compile/, so I changed a few variables in my CMake script for that, and it worked for sometime when I did something like this on my laptop: Compile$ cmake. I want that all CMake and make output files and folders to go into. Now my problem is that I have some source code, whose folder I don't want to touch/mess with when I make the program. This probably concludes all my knowledge in CMake. I'm pretty new to CMake, and read a few tutorials on how to use it, and wrote some complicated 50 lines of CMake script in order to make a program for 3 different compilers. ![]()
0 Comments
Leave a Reply. |