
if you do not have a C++ compiler, you canĭisable the check for it by explicitly listing the languages you want Optionally you can specify which languages your project supports.Įxample languages are CXX (i.e. The accepted answer that suggests appending the language to the project() statement simply adds more strict checking for what language is used (according to the documentation), but it wasn't helpful to me:
Cmake build directory code#
If CMake is unable to determine the language of the code correctly you can use the following: set_target_properties(hello PROPERTIES LINKER_LANGUAGE CXX) In my case this was due to having C++ files with the. I also got the error you mention: CMake Error: CMake can not determine linker language for target:helloworldĬMake Error: Cannot determine link language for target "helloworld".

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.
Cmake build directory how to#
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.
