Merge remote-tracking branch 'origin/master' into build-tests-option
This commit is contained in:
@@ -7,9 +7,9 @@ IF(BIICODE)
|
||||
ENDIF(BIICODE)
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_policy(VERSION 2.6)
|
||||
if(POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
endif()
|
||||
if(POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
endif()
|
||||
|
||||
project(tinyxml2)
|
||||
include(GNUInstallDirs)
|
||||
@@ -29,25 +29,6 @@ set(GENERIC_LIB_SOVERSION "4")
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/.")
|
||||
|
||||
################################
|
||||
# Add custom target to copy all data
|
||||
|
||||
set(TARGET_DATA_COPY DATA_COPY)
|
||||
set(DATA_COPY_FILES)
|
||||
if(NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
foreach(data dream.xml empty.xml utf8test.xml utf8testverify.xml)
|
||||
set(DATA_COPY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources/${data})
|
||||
set(DATA_COPY_DEST ${CMAKE_CURRENT_BINARY_DIR}/resources/${data})
|
||||
add_custom_command(
|
||||
OUTPUT ${DATA_COPY_DEST}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy ${DATA_COPY_SRC} ${DATA_COPY_DEST}
|
||||
DEPENDS ${DATA_COPY_SRC})
|
||||
list(APPEND DATA_COPY_FILES ${DATA_COPY_DEST})
|
||||
endforeach(data)
|
||||
endif(NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_custom_target(${TARGET_DATA_COPY} DEPENDS ${DATA_COPY_FILES})
|
||||
|
||||
################################
|
||||
# Add definitions
|
||||
|
||||
@@ -61,7 +42,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||
# Add targets
|
||||
# By Default shared libray is being built
|
||||
# To build static libs also - Do cmake . -DBUILD_STATIC_LIBS:BOOL=ON
|
||||
# User can choose not to build shared library by using cmake -BUILD_SHARED_LIBS:BOOL:OFF
|
||||
# User can choose not to build shared library by using cmake -DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
# To build only static libs use cmake . -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON
|
||||
# To build the tests, use cmake . -DBUILD_TESTS:BOOL=ON
|
||||
# To disable the building of the tests, use cmake . -DBUILD_TESTS:BOOL=OFF
|
||||
@@ -112,20 +93,21 @@ endif()
|
||||
if(BUILD_TESTS)
|
||||
add_executable(xmltest xmltest.cpp)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_dependencies(xmltest tinyxml2)
|
||||
add_dependencies(xmltest ${TARGET_DATA_COPY})
|
||||
target_link_libraries(xmltest tinyxml2)
|
||||
add_dependencies(xmltest tinyxml2)
|
||||
target_link_libraries(xmltest tinyxml2)
|
||||
else(BUILD_STATIC_LIBS)
|
||||
add_dependencies(xmltest tinyxml2_static)
|
||||
add_dependencies(xmltest ${TARGET_DATA_COPY})
|
||||
target_link_libraries(xmltest tinyxml2_static)
|
||||
add_dependencies(xmltest tinyxml2_static)
|
||||
target_link_libraries(xmltest tinyxml2_static)
|
||||
endif()
|
||||
|
||||
#add_test(xmltest ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)
|
||||
# Copy test resources and create test output directory
|
||||
add_custom_command(TARGET xmltest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
|
||||
COMMENT "Configuring xmltest resources directory: ${CMAKE_BINARY_DIR}/resources"
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
foreach(p LIB INCLUDE)
|
||||
|
||||
Reference in New Issue
Block a user