Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix an apparently corrupted CMake build?

Tags:

cmake

I am getting the following error from CMakeSetup on our source tree:

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_FIND_LIBRARY_PREFIXES 

Deleting the cache doesn't help, so something in one of the CMakeLists must be the problem. The weird part is, if I copy in a CMakeCache.txt from an old version of the tree, and edit it so that the paths match, CMake will then configure successfully... and, even after deleting that fixed cache, it continues to configure successfully.

Any idea what I should look for?

There are two variables missing from the bad CMakeCache.txt when it's generated: Project_BINARY_DIR and Project_SOURCE_DIR.

like image 685
UltraNurd Avatar asked Feb 20 '09 21:02

UltraNurd


People also ask

What is CMakeCache file?

The CMake cache may be thought of as a configuration file. The first time CMake is run on a project, it produces a CMakeCache. txt file in the top directory of the build tree. CMake uses this file to store a set of global cache variables, whose values persist across multiple runs within a project build tree.


1 Answers

Is your Project declared at the top and in your base CMakeLists.txt file or at the very least this has to be declared before it is needed, of which at the top is easiest. It appears this is a bug in cmake. http://www.mail-archive.com/[email protected]/msg13392.html

i.e.

PROJECT(inkscape)  SET(INKSCAPE_VERSION 0.46+devel) SET(PROJECT_NAME inkscape) CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6) SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)  ... 
like image 73
verbalshadow Avatar answered Sep 20 '22 22:09

verbalshadow