2012-03-26 23:50:52 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
|
|
|
cmake_policy(VERSION 2.6)
|
|
|
|
|
|
|
|
project(tinyxml2)
|
|
|
|
#enable_testing()
|
|
|
|
|
|
|
|
#CMAKE_BUILD_TOOL
|
|
|
|
|
2012-05-09 21:30:29 +00:00
|
|
|
################################
|
|
|
|
# set lib version here
|
|
|
|
|
|
|
|
set(GENERIC_LIB_VERSION "1.0.1")
|
|
|
|
set(GENERIC_LIB_SOVERSION "1")
|
|
|
|
|
|
|
|
|
2012-03-26 23:50:52 +00:00
|
|
|
################################
|
|
|
|
# Add common source
|
|
|
|
|
|
|
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/.")
|
|
|
|
|
|
|
|
################################
|
|
|
|
# Add custom target to copy all data
|
|
|
|
|
|
|
|
set(TARGET_DATA_COPY DATA_COPY)
|
|
|
|
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_custom_target(
|
|
|
|
${TARGET_DATA_COPY}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "In source build")
|
|
|
|
else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_custom_target(
|
|
|
|
${TARGET_DATA_COPY}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/dream.xml ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/utf8test.xml ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/utf8testverify.xml ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
set(OGL_DATA_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data)
|
|
|
|
|
|
|
|
################################
|
|
|
|
# Add definitions
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
endif(MSVC)
|
|
|
|
|
|
|
|
################################
|
|
|
|
# Add targets
|
2012-05-04 22:18:25 +00:00
|
|
|
SET(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries")
|
|
|
|
IF(BUILD_STATIC_LIBS)
|
|
|
|
add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h)
|
|
|
|
set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2)
|
|
|
|
ENDIF(BUILD_STATIC_LIBS)
|
|
|
|
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
|
2012-05-09 21:30:29 +00:00
|
|
|
set_target_properties(tinyxml2 PROPERTIES
|
|
|
|
VERSION "${GENERIC_LIB_VERSION}"
|
|
|
|
SOVERSION "${GENERIC_LIB_SOVERSION}")
|
2012-03-26 23:50:52 +00:00
|
|
|
|
|
|
|
add_executable(test xmltest.cpp)
|
|
|
|
add_dependencies(test tinyxml2)
|
|
|
|
add_dependencies(test ${TARGET_DATA_COPY})
|
|
|
|
target_link_libraries(test tinyxml2)
|
2012-05-04 22:18:25 +00:00
|
|
|
|
|
|
|
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "")
|
|
|
|
IF(BUILD_STATIC_LIBS)
|
|
|
|
INSTALL(TARGETS tinyxml2 tinyxml2static
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
ELSE(BUILD_STATIC_LIBS)
|
|
|
|
INSTALL(TARGETS tinyxml2
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
ENDIF(BUILD_STATIC_LIBS)
|
2012-05-04 22:32:02 +00:00
|
|
|
INSTALL(FILES tinyxml2.h DESTINATION include)
|
2012-05-04 22:18:25 +00:00
|
|
|
|
2012-03-26 23:50:52 +00:00
|
|
|
#add_test(test ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)
|