[CMake] problem setting CMAKE_BUILD_TYPE and CMAKE_INSTALL_PREFIX

Brandon Van Every bvanevery at gmail.com
Tue Jan 29 12:53:55 EST 2008


On Jan 29, 2008 10:42 AM, Yogesh Marwaha <yogeshm.007 at gmail.com> wrote:
> Ok, got it.
>
> Here is new CMakeLists.txt
> ========================
> project (eSpy)
> cmake_minimum_required (VERSION 2.4.0)
> if(NOT CMAKE_BUILD_TYPE)
>     set (CMAKE_BUILD_TYPE Release)
> endif(NOT CMAKE_BUILD_TYPE)
> if(NOT CMAKE_INSTALL_PREFIX)
>     set (CMAKE_INSTALL_PREFIX "/usr/local")
> endif(NOT CMAKE_INSTALL_PREFIX)
> find_package (Qt4 REQUIRED)
> add_subdirectory (eSpy)
> add_subdirectory (eSpyDLin)
> ======================
>
> Now CMAKE_BUILD_TYPE and CMAKE_INSTALL_PREFIX are only set if not
> previously set/defined.
> Now no one should have any complaint. Right?

CMAKE_INSTALL_PREFIX always has a default.  Your command above does nothing.

Similarly, if(NOT CMAKE_BUILD_TYPE) is nonsensical.  From the CMake
Useful Variables wiki entry: "Note that CMAKE_BUILD_TYPE is not
initialized with a readable value at configuration time. This is
because the user is free to select a build type at build time. Use
CMAKE_CFG_INTDIR if you need a variable that evaluates to the correct
build time directory. "


Cheers,
Brandon Van Every


More information about the CMake mailing list