Hello guys, I have some troubles with CMakes handling of INSTALL_PREFIX. I am not sure if it is CMake or just me being a goof, so I hope somebody more knowledgable can guide me.
As a background, I have a project (or rather a list of procets) I wish to do automated compile on. I have set of batch files to load stuff from git, configure, build and finally install everything. I keep two things separate in two separate trees defined by architecture and build. Nothing too fancy, just standard jazz, one tree for x66 and another for x64 and each tree has build and release branch. It works more or less as I wanted it, but one minor annoyance. When CMake does the final install, it seems to use the path from cache file and ignores that I am giving it another install path on the comand line. I have tried to delete CMakeCache.txt before doing build but it didn't help. The only way to get CMake to reflect difference in installation paths is to wipe entire build directory and to reconfigure everything from scratch for every build. That effectively doubles the time for build! CMake correctly builds different configurations but it seems to don't care for possible difference in installation. How it works is that, it always uses path from the first build. Thus if I build release build first it installs all binaries into "release" path, even for debug build, despite that it gets correct path on the command line. And contrary if I build debug build first it will install even binaries from release build into debug path. I can't post all batch files involved, there are several, configuration, driver helper, but some relevant points: Here is how INSTALL_PREFIX is constructed: (...) Set INSTALL_PREFIX=%INSTALL_BASE%\%BUILD_PLATFORM%\%BUILD_CONFIG% if not exist "%INSTALL_PREFIX%" mkdir "%INSTALL_PREFIX%" Set CMAKE_OPT=%CMAKE_OPT% -DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX% (...) All variables are correctly passed, and it builds everything fine but it refuses to reflect change in installation prefix in different builds. I just wonder if it is me goofing somewhere, or is it the way CMakes operates? Can I change this behaviour anyhow without need to parse CMakeCache.txt manually or as I do now as a quick fix, reconfiguring entire project from scratch for every configuration? As a curiosa, here is a small part of a driver file that actually invoke cmake, don't worry about other script it's just for configuration, so you get an idea of what I'm doing (vs2015 automated build): :dobuild if exist %BUILD_DIR% rd /S /q %BUILD_DIR% call %~dp0\cmake-setvars.bat cd "%BUILD_DIR%" set PATH=%INSTALL_PREFIX%\bin;%PATH%; cmake %CMAKE_OPT% .. MSBuild ALL_BUILD.vcxproj /p:Configuration=%BUILD_CONFIG%,Platform=%BUILD_PLATFORM%,PlatformToolset=v140 MSBuild INSTALL.vcxproj /p:Configuration=%BUILD_CONFIG%,Platform=%BUILD_PLATFORM% cd .. goto:eof All help is appreciated. -- http://www.fastmail.com - A no graphics, no pop-ups email service -- 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
