[CMake] emulating cmake-gui behaviour with cmake commandline on windows

David Cole DLRdave at aol.com
Fri Aug 7 12:27:40 EDT 2015


Put your source in a sub-directory. CMake simply does not work at the
root of a drive letter on Windows. CMakeLists.txt MUST be in at least
one sub-directory underneath a root drive letter path.


HTH,
David C.



On Fri, Aug 7, 2015 at 5:08 AM, Johannes Schauer <josch at debian.org> wrote:
> Hi,
>
> I am trying to build the CMake project 3dtk with the following CMakeLists.txt:
> https://sourceforge.net/p/slam6d/code/HEAD/tree/trunk/CMakeLists.txt
>
> This works well on linux with ccmake and also on windows with cmake-gui.
>
> Now I'm trying to let it work on windows with the cmake command line program to
> automate the configuration. Unfortunately I'm running into a problem with cmake
> on windows that I did not encounter with cmake-gui.
>
> The CMakeLists.txt file at several occasions uses the add_subdirectory
> directive but always without the second argument (the build_dir). This seems to
> work fine for cmake-gui on windows and ccmake on linux. But with cmake on
> windows I now get the following message for every add_subdirectory directive:
>
> CMake Error at Z:/CMakeLists.txt:471 (add_subdirectory):
>   add_subdirectory not given a binary directory but the given source
>   directory "Z:/src/slam6d" is not a subdirectory of "Z:/". When specifying
>   an out-of-tree source a binary directory must be explicitly specified.
>
> This error message is also strange because clearly, "Z:/src/slam6d" is a
> subdirectory of "Z:/".
>
> I would like to know the command line option that I have to supply to cmake on
> windows to get the same behaviour as with cmake-gui on windows.
>
> In my case, the source is in Z:/ and in cmake-gui I specify
> "Z:/lib64-msvc-12.0" as the value of "Where to build the binaries" and as
> explained above this works completely well.
>
> But after successfully configuring and generating the project in
> "Z:/lib64-msvc-12.0" using the cmake-gui method, when I cd into
> "Z:/lib64-msvc-12.0" and just run "cmake .." I get the error messages above.
>
> Same happens when I create a new directory "Z:/cmaketest", cd into it and then
> run "cmake ..", I again get the errors above.
>
> So in summary, with or without an existing CMakeCache.txt, I'm running into the
> error messages above on windows when using cmake (and not cmake-gui). So I
> suspect that I'm missing an option to cmake to make it behave like cmake-gui.
>
> I don't think my CMakeLists.txt is the culprit because that one works totally
> fine on linux and also works well with cmake-gui.
>
> What could the problem be?
>
> Thanks!
>
> cheers, josch
>
> --
>
> 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


More information about the CMake mailing list