CMakeLists.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. project(pugixml)
  2. cmake_minimum_required(VERSION 2.8.12)
  3. option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
  4. set(BUILD_DEFINES "" CACHE STRING "Build defines")
  5. if(MSVC)
  6. option(STATIC_CRT "Use static CRT libraries" OFF)
  7. # Rewrite command line flags to use /MT if necessary
  8. if(STATIC_CRT)
  9. foreach(flag_var
  10. CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
  11. CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
  12. if(${flag_var} MATCHES "/MD")
  13. string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
  14. endif(${flag_var} MATCHES "/MD")
  15. endforeach(flag_var)
  16. endif()
  17. endif()
  18. set(HEADERS pugixml.hpp pugiconfig.hpp)
  19. set(SOURCES ${HEADERS} pugixml.cpp)
  20. if(DEFINED BUILD_DEFINES)
  21. foreach(DEFINE ${BUILD_DEFINES})
  22. add_definitions("-D" ${DEFINE})
  23. endforeach()
  24. endif()
  25. if(BUILD_SHARED_LIBS)
  26. add_library(pugixml SHARED ${SOURCES})
  27. else()
  28. add_library(pugixml STATIC ${SOURCES})
  29. endif()
  30. dolphin_disable_warnings(pugixml)
  31. set_target_properties(pugixml PROPERTIES VERSION 1.8 SOVERSION 1)
  32. get_target_property(PUGIXML_VERSION_STRING pugixml VERSION)
  33. target_include_directories(pugixml PUBLIC ./)