[CMake] Please critique my "hello world" CMakeLists.txt and Config.cmake

Ansis Māliņš ansis.malins at gmail.com
Sun Feb 24 05:23:37 EST 2013


# You don't need the .in file.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(hello)

set (hello_VERSION_MAJOR 1)
set (hello_VERSION_MINOR 1)

ENABLE_TESTING()

ADD_LIBRARY(hello hello.cpp)

# This works just the same. Unless I'm missing something.
SET(hello_INCLUDE_DIRS

${CMAKE_INSTALL_PREFIX}/include/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR})
SET(hello_LIBRARIES

${CMAKE_INSTALL_PREFIX}/lib/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR}/libhello.a)

INSTALL(TARGETS hello DESTINATION
  lib/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR})

INSTALL(FILES helloConfig.cmake DESTINATION
  lib/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR})

INSTALL(FILES hello.h DESTINATION
  include/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR})
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130224/2bc2453c/attachment.htm>


More information about the CMake mailing list