- Include GNUInstallDirs which sets up standard install locations including lib64 for mulilib systems. - Make BUILD_SHARED_LIBS an option instead of a variable which is better for use in either the cmake-gui or ccmake gui interfaces. - Setup a destination for WIN32 runtime DLL's which is also helpful for MinGW installs. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1012 99668b35-9821-0410-8761-19e4c4f06640
35 lines
1022 B
CMake
35 lines
1022 B
CMake
project(pugixml)
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
|
set(BUILD_DEFINES "" CACHE STRING "Build defines")
|
|
|
|
# Pre-defines standard install locations on *nix systems.
|
|
include(GNUInstallDirs)
|
|
mark_as_advanced(CLEAR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
|
|
|
|
set(HEADERS ../src/pugixml.hpp ../src/pugiconfig.hpp)
|
|
set(SOURCES ${HEADERS} ../src/pugixml.cpp)
|
|
|
|
if(DEFINED BUILD_DEFINES)
|
|
add_definitions(${BUILD_DEFINES})
|
|
endif()
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
add_library(pugixml SHARED ${SOURCES})
|
|
else()
|
|
add_library(pugixml STATIC ${SOURCES})
|
|
endif()
|
|
|
|
set_target_properties(pugixml PROPERTIES VERSION 1.4 SOVERSION 1)
|
|
|
|
install(TARGETS pugixml EXPORT pugixml-config
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
)
|
|
|
|
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml)
|