[CMake] CMAKE_CXX_COMPILE_OBJECT not set with ADD_SUBDIRECTORY

Emmanuel HOUITTE Emmanuel.HOUITTE at ingenico.com
Fri Sep 11 09:26:47 EDT 2015


I'm working with cmake version 2.8.12.2 on CentOS6.
I've got a very simple project with one subdirectory.
Each directory has a CMakeLists.txt file.
The ADD_SUBDIRECTORY seems to remove the default generated CMAKE rule variables in the generation step.
Is it normal? How to get an example without generation errors?
If I replace the ADD_SUBDIRECTORY by the code of the second CMakeLists.txt, there is no problem.

This is the content of my project:

-- lib
   CMakeLists.txt
   {
   CMAKE_MINIMUM_REQUIRED (VERSION 2.8.8)
   ADD_SUBDIRECTORY(libtest)
   PROJECT(lib)
   }
   -- libtest
      CMakeLists.txt
      {
      FILE(WRITE "empty.cpp" "")
      ADD_LIBRARY(test STATIC empty.cpp )
      }

And the results:

$ cmake -DCMAKE_BUILD_TYPE=Release
-- Configuring done
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILE_OBJECT
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_CREATE_STATIC_LIBRARY
-- Generating done
-- Build files have been written to: /home/test/lib
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150911/12a1cb4d/attachment.html>


More information about the CMake mailing list