forked from sainteos/tmxparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (34 loc) · 1.56 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 2.8)
project(tmxparser)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
message("Configuring tmxparser version ${VERSION}")
file(GLOB_RECURSE SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
find_package(TinyXML2)
find_package(ZLIB)
set(LIB_CFLAGS "-pedantic -Werror -Wall -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes")
set(EXAMPLE_CFLAGS "-pedantic -Werror -Wall")
#include_directories("${PROJECT_SOURCE_DIR}/include")
add_library(tmxparser_static STATIC ${SOURCES} ${HEADERS})
set_target_properties(tmxparser_static PROPERTIES
OUTPUT_NAME tmxparser
COMPILE_FLAGS ${LIB_CFLAGS})
add_library(tmxparser SHARED ${SOURCES} ${HEADERS})
set_target_properties(tmxparser PROPERTIES
SOVERSION ${VERSION_MAJOR}
VERSION ${VERSION}
COMPILE_FLAGS ${LIB_CFLAGS})
target_link_libraries(tmxparser ${TINYXML2_LIBRARIES} ${ZLIB_LIBRARIES})
include_directories(${TINYXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
add_executable(test test/test.cpp)
set_target_properties(test PROPERTIES
COMPILE_FLAGS ${EXAMPLE_CFLAGS})
target_link_libraries(test tmxparser ${TINYXML2_LIBRARIES})
install(FILES ${HEADERS} DESTINATION include/tmxparser)
install(TARGETS tmxparser tmxparser_static DESTINATION lib)
configure_file(src/tmxparser.pc.in tmxparser.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmxparser.pc DESTINATION lib/pkgconfig)