Skip to content

Commit

Permalink
Merge pull request #3 from xantares/tinyxml2
Browse files Browse the repository at this point in the history
TinyXML platform check
  • Loading branch information
hhirsch committed Oct 31, 2014
2 parents 5a496d0 + cc172dd commit ece2c41
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Expand Up @@ -28,6 +28,12 @@ find_package(SDL2_mixer REQUIRED)
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIRS})
list(APPEND PORTAL_LIBRARIES ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARIES} )

find_package(TinyXML REQUIRED)
include_directories(${TINYXML_INCLUDE_DIR})
list(APPEND PORTAL_LIBRARIES ${TINYXML_LIBRARIES} )



set(PORTAL_TEST_LIBRARIES ${PORTAL_LIBRARIES})

add_subdirectory(data)
Expand Down
28 changes: 28 additions & 0 deletions cmake/FindTinyXML.cmake
@@ -0,0 +1,28 @@
# - Find TinyXML
# Find the native TinyXML includes and library
#
# TINYXML_FOUND - True if TinyXML found.
# TINYXML_INCLUDE_DIR - where to find tinyxml.h, etc.
# TINYXML_LIBRARIES - List of libraries when using TinyXML.
#

IF( TINYXML_INCLUDE_DIR )
# Already in cache, be silent
SET( TinyXML_FIND_QUIETLY TRUE )
ENDIF( TINYXML_INCLUDE_DIR )

FIND_PATH( TINYXML_INCLUDE_DIR "tinyxml.h"
PATH_SUFFIXES "tinyxml" )
set (TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR})

FIND_LIBRARY( TINYXML_LIBRARY
NAMES "tinyxml"
PATH_SUFFIXES "tinyxml" )
set (TINYXML_LIBRARIES ${TINYXML_LIBRARY})

# handle the QUIETLY and REQUIRED arguments and set TINYXML_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( "FindPackageHandleStandardArgs" )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( "TinyXML" DEFAULT_MSG TINYXML_LIBRARY TINYXML_INCLUDE_DIR )

MARK_AS_ADVANCED( TINYXML_LIBRARY TINYXML_INCLUDE_DIR TINYXML_INCLUDE_DIRS TINYXML_LIBRARIES )
2 changes: 1 addition & 1 deletion source/CMakeLists.txt
Expand Up @@ -31,7 +31,7 @@ add_executable(${EXE_NAME}
engine/env/Config.cpp
engine/env/Path.cpp
)
target_link_libraries(${EXE_NAME} ${PORTAL_LIBRARIES} tinyxml)
target_link_libraries(${EXE_NAME} ${PORTAL_LIBRARIES})
install(TARGETS ${EXE_NAME} DESTINATION bin)

add_custom_target(run COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}${CMAKE_EXECUTABLE_SUFFIX} -datadir ${CMAKE_SOURCE_DIR}/data/ )
Expand Down

0 comments on commit ece2c41

Please sign in to comment.