cmake
Bouw configuraties
Zoeken…
Invoering
Dit onderwerp toont het gebruik van verschillende CMake-configuraties zoals Debug of Release, in verschillende omgevingen.
Een release / debug-configuratie instellen
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}/"
)
Voer in de volgende builds twee verschillende ('/ opt / myproject / lib / Debug' '/ opt / myproject / lib / Release') mappen met de bibliotheken uit:
$ cd /myproject/build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
$ sudo make install
$ cmake _DCMAKE_BUILD_TYPE=Release ..
$ make
$ sudo make install
Modified text is an extract of the original Stack Overflow Documentation
Licentie onder CC BY-SA 3.0
Niet aangesloten bij Stack Overflow