CMake初始缓存文件的设置被忽略:它之前有效

时间:2015-06-05 14:19:39

标签: cmake

我担心我的Windows 8.1操作系统可能已被黑客入侵,因为我无法解释为什么会出现此问题的其他任何原因。

这是我以前工作过的缓存文件的内容:

set(WITH_SDL ON CACHE BOOL "")
set(WITH_AUDIO ON CACHE BOOL "")

set(WITH_MOVIES OFF CACHE BOOL "")
set(WITH_FREETYPE2 OFF CACHE BOOL "")
set(WITH_LUAJIT OFF CACHE BOOL "")
set(WITH_LIBAV OFF CACHE BOOL "")
set(BUILD_ANIMVIEWER OFF CACHE BOOL "")
set(BUILD_MAPEDITOR OFF CACHE BOOL "")

set(LUA_INCLUDE_DIR "C:/Program Files (x86)/Lua/5.3.0/include" CACHE PATH "")
set(LUA_LIBRARY "C:/Program Files (x86)/Lua/5.3.0/lua53.lib" CACHE FILEPATH "")
set(SDL_INCLUDE_DIR "C:/Users/Joseph/Programming/Github/Libraries/SDL2-2.0.3/include" CACHE PATH "")
set(SDL_LIBRARY "C:/Users/Joseph/Programming/Github/Libraries/SDL2-2.0.3/lib/x86/SDL2.lib" CACHE FILEPATH "")
set(SDL_INCLUDE_DIR "C:/Users/Joseph/Programming/Github/Libraries/SDL2_mixer- 2.0.0/include" CACHE PATH "")
set(SDL_MIXER_LIBRARY "C:/Users/Joseph/Programming/Github/Libraries/SDL2_mixer-2.0.0/lib/x86/SDL2_mixer.lib" CACHE FILEPATH "")

所有路径仍然有效。

以下是我使用的命令: cmake -C "C:/Users/Joseph/Desktop/initial_cache.cmake" --build "C:/Users/Joseph/Programming/Github/CorsixTH/build" -g "Visual Studio 12 2013" C:/Users/Joseph/Programming/Github/CorsixTH/

命令终端的输出:

loading initial cache file c:/Users/Joseph/Desktop/initial_cache.cmake
-- Building for: Visual Studio 12 2013
Note: SDL audio is enabled (default)
Note: FFMPEG video is enabled (default)
Note: FreeType2 is enabled (default)
Note: Visual Leak Detector is disabled (default)

Building CorsixTH
-- Could NOT find SDL (missing:  SDL_INCLUDE_DIR)
CMake Error at CorsixTH/CMakeLists.txt:105 (message):
Error: SDL library not found, it is required to build.  Make sure the path
  is correctly defined or set the environment variable SDLDIR to the correct
  location

-- Configuring incomplete, errors occurred!
See also "C:/Users/Joseph/CMakeFiles/CMakeOutput.log".

首次成功使用此缓存文件后,我添加了更多命令,然后它停止工作,因此我删除了新命令,但这并没有让它再次运行。

我尝试删除cmake缓存,告诉CMake GUI删除它,我尝试使用新下载的CorsixTH源代码目录。

1 个答案:

答案 0 :(得分:0)

如果我查看CrosixTH/CMakeLists.txt和CMake的Modules\FindSDL.cmake SDLDIR环境变量确实必须在那里(它不会被缓存,因此每次配置过程开始时都会读取再次)。

因此,我假设发生的事情是您在CMakeLists.txt重新触发ZERO_CHECK并且您的VS环境缺少SDLDIR变量时更改了某些内容的那一刻。

你要么:

  • 将其添加到您的全局环境变量
  • 将其添加到您的VS项目的环境变量(CMake本身尚不可能)
  • set(ENV{SDLDIR} "C:/Users/Joseph/Programming/Github/Libraries/SDL2-2.0.3")添加到您的缓存文件中(但这不符合仅将缓存变量放入其中)
  • 为这种预设编写自己的VS工具链文件(这是我为使这些工作变得可靠而做的事情)

一些参考文献: