From: Kornel Benko Date: Fri, 24 May 2024 18:26:04 +0000 (+0200) Subject: Cmake build: Initialize variable 'CMAKE_INSTALL_PREFIX' before use X-Git-Tag: 2.4.1~63 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6186506033098b52726abd6ccbddc2236f4310ed;p=lyx.git Cmake build: Initialize variable 'CMAKE_INSTALL_PREFIX' before use Spotted by Eugene Chornyi (cherry picked from commit ea74574d8f02481732b591306410e3c49faae87d) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index dcbdee812a..58c6b1eb52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -526,8 +526,19 @@ endif() if(LYX_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE) set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(LYX_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE) endif() -set(LYX_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + # see http://www.cmake.org/pipermail/cmake/2006-October/011559.html + if (UNIX) + # use the default "/usr/local" + # but respect the user-choice on the command-line + set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "LyX default install prefix" FORCE) + endif() + if(WIN32) + set(CMAKE_INSTALL_PREFIX LYX_INSTALLED CACHE PATH "LyX default install prefix" FORCE) + endif() + endif() if(UNIX) set(SYSTEM_DATADIR "${CMAKE_INSTALL_PREFIX}/share") @@ -561,17 +572,6 @@ else() set(PACKAGE ${PACKAGE_BASE}) endif() -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - # see http://www.cmake.org/pipermail/cmake/2006-October/011559.html - if (UNIX) - # use the default "/usr/local" - # but respect the user-choice on the command-line - set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "LyX default install prefix" FORCE) - endif() -endif() -if(WIN32) - set(CMAKE_INSTALL_PREFIX LYX_INSTALLED CACHE PATH "LyX default install prefix" FORCE) -endif() if(IS_ABSOLUTE) set(CMAKE_INSTALL_PREFIX_ABSOLUTE ${CMAKE_INSTALL_PREFIX}) else()