cmake
Configurations de construction
Recherche…
Introduction
Cette rubrique présente les utilisations de différentes configurations CMake telles que Debug ou Release, dans différents environnements.
Définition d'une configuration Release / Debug
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}/"
)
Effectuer les versions suivantes générera deux dossiers différents ('/ opt / myproject / lib / Debug' '/ opt / myproject / lib / Release') avec les bibliothèques:
$ 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
Sous licence CC BY-SA 3.0
Non affilié à Stack Overflow