From abcdbd911297027da158fca231235071e386988b Mon Sep 17 00:00:00 2001 From: Chow Loong Jin Date: Wed, 23 May 2012 19:42:36 +0800 Subject: [PATCH 1/2] Standardize style of CMakeLists.txt 1. Use lowercase commands everywhere 2. Use tabs for indentation --- CMakeLists.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 556c7a7..491611b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,11 +46,11 @@ endif(MSVC) ################################ # Add targets -SET(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries") -IF(BUILD_STATIC_LIBS) +set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries") +if(BUILD_STATIC_LIBS) add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h) set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2) -ENDIF(BUILD_STATIC_LIBS) +endif(BUILD_STATIC_LIBS) add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h) set_target_properties(tinyxml2 PROPERTIES VERSION "${GENERIC_LIB_VERSION}" @@ -62,21 +62,21 @@ add_dependencies(test ${TARGET_DATA_COPY}) target_link_libraries(test tinyxml2) -IF(BUILD_STATIC_LIBS) - INSTALL(TARGETS tinyxml2 tinyxml2static +if(BUILD_STATIC_LIBS) + install(TARGETS tinyxml2 tinyxml2static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -ELSE(BUILD_STATIC_LIBS) - INSTALL(TARGETS tinyxml2 +else(BUILD_STATIC_LIBS) + install(TARGETS tinyxml2 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -ENDIF(BUILD_STATIC_LIBS) -INSTALL(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +endif(BUILD_STATIC_LIBS) +install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) foreach(p LIB INCLUDE) - set(var CMAKE_INSTALL_${p}DIR) - if(NOT IS_ABSOLUTE "${${var}}") - set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") - endif() + set(var CMAKE_INSTALL_${p}DIR) + if(NOT IS_ABSOLUTE "${${var}}") + set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") + endif() endforeach() configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY) From 0eb8e9da08284451ed583f0616dace4d8ec8c495 Mon Sep 17 00:00:00 2001 From: Chow Loong Jin Date: Thu, 24 May 2012 02:44:19 +0800 Subject: [PATCH 2/2] Fix out of source installation with tinyxml2.pc --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 491611b..df2536e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,6 @@ foreach(p LIB INCLUDE) endforeach() 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 $)