Merge pull request #2 from hyperair/master

Cosmetic fixes to CMakeLists.txt and a fix for out-of-source-tree builds when installing the .pc file
This commit is contained in:
hasufell 2012-05-23 17:58:58 -07:00
commit 2cc75b32b5
1 changed files with 14 additions and 14 deletions

View File

@ -46,11 +46,11 @@ endif(MSVC)
################################ ################################
# Add targets # Add targets
SET(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries") set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries")
IF(BUILD_STATIC_LIBS) if(BUILD_STATIC_LIBS)
add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h) add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2) set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2)
ENDIF(BUILD_STATIC_LIBS) endif(BUILD_STATIC_LIBS)
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h) add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2 PROPERTIES set_target_properties(tinyxml2 PROPERTIES
VERSION "${GENERIC_LIB_VERSION}" VERSION "${GENERIC_LIB_VERSION}"
@ -62,15 +62,15 @@ add_dependencies(test ${TARGET_DATA_COPY})
target_link_libraries(test tinyxml2) target_link_libraries(test tinyxml2)
IF(BUILD_STATIC_LIBS) if(BUILD_STATIC_LIBS)
INSTALL(TARGETS tinyxml2 tinyxml2static install(TARGETS tinyxml2 tinyxml2static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ELSE(BUILD_STATIC_LIBS) else(BUILD_STATIC_LIBS)
INSTALL(TARGETS tinyxml2 install(TARGETS tinyxml2
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF(BUILD_STATIC_LIBS) endif(BUILD_STATIC_LIBS)
INSTALL(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
foreach(p LIB INCLUDE) foreach(p LIB INCLUDE)
set(var CMAKE_INSTALL_${p}DIR) set(var CMAKE_INSTALL_${p}DIR)
@ -80,6 +80,6 @@ foreach(p LIB INCLUDE)
endforeach() endforeach()
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY) configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
install(FILES tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
#add_test(test ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>) #add_test(test ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)