From b1ff002ba630699a9a55be14c16e73a80b054432 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 27 Mar 2012 00:50:52 +0100 Subject: [PATCH] Added cmake support --- CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3d9c670 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 2.6 FATAL_ERROR) +cmake_policy(VERSION 2.6) + +project(tinyxml2) +#enable_testing() + +#CMAKE_BUILD_TOOL + +################################ +# 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 + +add_library(tinyxml2 STATIC tinyxml2.cpp tinyxml2.h) + +add_executable(test xmltest.cpp) +add_dependencies(test tinyxml2) +add_dependencies(test ${TARGET_DATA_COPY}) +target_link_libraries(test tinyxml2) +#add_test(test ${SAMPLE_NAME} COMMAND $)