good afternoon,

I am following the CMake book to learn about CMake. I have trouble to follow chapter 3: build configurations (https://riptutorial.com/cmake/example/26702/setting-a-release-debug-configuration)

In this part it is not very clear why these configurations are used, and how they work.

here is the script in cmake:

*CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)**
**SET(PROJ_NAME "myproject")**
**PROJECT(${PROJ_NAME})**
**
*# Configuration types*
**SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)**
**IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")**
**  SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})**
**ENDIF()**
**
**SET(${PROJ_NAME}_PATH_INSTALL "/opt/project"                     CACHE PATH "This directory contains installation Path")**
**SET(CMAKE_DEBUG_POSTFIX "d")**
*
# Install
#---------------------------------------------------#*
**INSTALL(TARGETS ${PROJ_NAME}**
**    DESTINATION "${${PROJ_NAME}_PATH_INSTALL}/lib/${CMAKE_BUILD_TYPE}/"**
**    )**
*

So, instead of building the project relative to my project folder, it installs into "/opt/" directory in linux. Why would I want/prefere to do that? And what if I am working with Windows, instead?

Since the application is build in "/opt/" it suggests that cmake in above example functions similar to an software installer.


The documentation on cmake.org states that CMAKE_CONFIGURATION_TYPES specifies multiple build types (Debug, Release, Test, etc), which is ultimately what I am interested in.

I suppose I am also able to use this concept if I want relative path for debug/release directories like in Eclipse?


thank you!

-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to