From 28c63aea72c5bb5ea53bf69e3216edf97f4def52 Mon Sep 17 00:00:00 2001 From: Roman Proskuryakov Date: Sun, 12 Jun 2016 21:03:33 +0300 Subject: [PATCH] Uses FindTinyXML to find package --- CMakeLists.txt | 15 +++---------- apps/openmw/CMakeLists.txt | 2 +- extern/oics/CMakeLists.txt | 43 ++++++++++++++------------------------ 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c96a18e03..14a1c15c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,17 +155,10 @@ add_definitions(-D__STDC_CONSTANT_MACROS) # TinyXML option(USE_SYSTEM_TINYXML "Use system TinyXML library instead of internal." OFF) -if(USE_SYSTEM_TINYXML) - find_library(TINYXML_LIBRARIES tinyxml) - find_path(TINYXML_INCLUDE_DIR tinyxml.h) - message(STATUS "Found TinyXML: ${TINYXML_LIBRARIES} ${TINYXML_INCLUDE_DIR}") +if (USE_SYSTEM_TINYXML) + find_package(TinyXML REQUIRED) add_definitions (-DTIXML_USE_STL) - if(TINYXML_LIBRARIES AND TINYXML_INCLUDE_DIR) - include_directories(${TINYXML_INCLUDE_DIR}) - message(STATUS "Using system TinyXML library.") - else() - message(FATAL_ERROR "Detection of system TinyXML incomplete.") - endif() + include_directories(SYSTEM ${TinyXML_INCLUDE_DIRS}) endif() # Platform specific @@ -676,8 +669,6 @@ if (WIN32) endforeach(d) set_target_properties(components PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") - # oics uses tinyxml, which has an initialized but unused variable - set_target_properties(oics PROPERTIES COMPILE_FLAGS "${WARNINGS} /wd4189 ${MT_BUILD}") set_target_properties(osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") if (BUILD_BSATOOL) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 8e938e033..f7a9fea3c 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -165,7 +165,7 @@ if (ANDROID) endif (ANDROID) if (USE_SYSTEM_TINYXML) - target_link_libraries(openmw ${TINYXML_LIBRARIES}) + target_link_libraries(openmw ${TinyXML_LIBRARIES}) endif() if (NOT UNIX) diff --git a/extern/oics/CMakeLists.txt b/extern/oics/CMakeLists.txt index 52ffb42a2..00d77f52c 100644 --- a/extern/oics/CMakeLists.txt +++ b/extern/oics/CMakeLists.txt @@ -1,32 +1,21 @@ -set(OICS_LIBRARY "oics") - -# Sources - -set(OICS_SOURCE_FILES - ICSChannel.cpp - ICSControl.cpp - ICSInputControlSystem.cpp - ICSInputControlSystem_keyboard.cpp - ICSInputControlSystem_mouse.cpp - ICSInputControlSystem_joystick.cpp - ICSPrerequisites.h -) - -set(TINYXML_SOURCE_FILES - tinyxml.cpp - tinyxmlparser.cpp - tinyxmlerror.cpp - tinystr.cpp +add_library(oics STATIC + ICSChannel.cpp + ICSControl.cpp + ICSInputControlSystem.cpp + ICSInputControlSystem_keyboard.cpp + ICSInputControlSystem_mouse.cpp + ICSInputControlSystem_joystick.cpp + ICSPrerequisites.h ) if(USE_SYSTEM_TINYXML) - add_library(${OICS_LIBRARY} STATIC ${OICS_SOURCE_FILES}) - target_link_libraries(${OICS_LIBRARY} ${TINYXML_LIBRARIES}) + target_link_libraries(oics ${TinyXML_LIBRARIES}) else() - add_library(${OICS_LIBRARY} STATIC - ${OICS_SOURCE_FILES} - ${TINYXML_SOURCE_FILES}) + add_library(local_tinyxml STATIC + tinyxml.cpp + tinyxmlparser.cpp + tinyxmlerror.cpp + tinystr.cpp + ) + target_link_libraries(oics local_tinyxml) endif() - -# Does this do anything? -link_directories(${CMAKE_CURRENT_BINARY_DIR})