From 469c0242d485ca325c9c620d04449ee049e2f848 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Thu, 4 Aug 2011 19:23:55 +0200 Subject: [PATCH] Improved CMake support for libsvn Added missing CMake defines for SVN_CLIENT. Don't detect libsvn without APR. When installed, enable libsvn support by default (same as for automake). When enabled, provide libsvn include dir to libtsync. gitignore temporary CMake files --- .gitignore | 1 + CMakeLists.txt | 6 ++-- CMakeModules/FindSvnClient.cmake | 51 ++++++++++++++++-------------- simgear/scene/tsync/CMakeLists.txt | 11 +++++++ simgear/simgear_config_cmake.h.in | 3 ++ 5 files changed, 46 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 290f76f9..c74854a7 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,6 @@ CMakeCache.txt CPackConfig.cmake CPackSourceConfig.cmake cmake_uninstall.cmake +CTestTestfile.cmake install_manifest.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 517d87df..e97a0e8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") option(SIMGEAR_SHARED "Set to ON to build SimGear as a shared library/framework" OFF) option(SIMGEAR_HEADLESS "Set to ON to build SimGear with GUI/graphics support" OFF) option(JPEG_FACTORY "Enable JPEG-factory support" OFF) -option(ENABLE_LIBSVN "Set to ON to build SimGear with libsvnclient support" OFF) +option(ENABLE_LIBSVN "Set to ON to build SimGear with libsvnclient support" ON) set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted") @@ -71,11 +71,13 @@ endif() if(ENABLE_LIBSVN) find_package(SvnClient) - + if(LIBSVN_FOUND) message(STATUS "libsvn found, enabling in SimGear") set(HAVE_SVN_CLIENT_H 1) set(HAVE_LIBSVN_CLIENT_1 1) + else() + message(STATUS "Missing libsvn, unable to enable SVN in SimGear") endif(LIBSVN_FOUND) endif(ENABLE_LIBSVN) diff --git a/CMakeModules/FindSvnClient.cmake b/CMakeModules/FindSvnClient.cmake index 717b8b04..baf03027 100644 --- a/CMakeModules/FindSvnClient.cmake +++ b/CMakeModules/FindSvnClient.cmake @@ -22,27 +22,30 @@ else(HAVE_APR_CONFIG) message(STATUS "apr-1-config not found, implement manual search for APR") endif(HAVE_APR_CONFIG) -find_path(LIBSVN_INCLUDE_DIR svn_client.h - HINTS - $ENV{LIBSVN_DIR} - PATH_SUFFIXES include/subversion-1 - PATHS - /usr/local - /usr - /opt -) - -check_library_exists(svn_client-1 svn_client_checkout "" HAVE_LIB_SVNCLIENT) -check_library_exists(svn_subr-1 svn_cmdline_init "" HAVE_LIB_SVNSUBR) -check_library_exists(svn_ra-1 svn_ra_initialize "" HAVE_LIB_SVNRA) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG - HAVE_LIB_SVNSUBR - HAVE_LIB_SVNCLIENT - HAVE_LIB_SVNRA - LIBSVN_INCLUDE_DIR) - -if(LIBSVN_FOUND) - set(LIBSVN_LIBRARIES "svn_client-1" "svn_subr-1" "svn_ra-1" ${APR_LIBS}) -endif(LIBSVN_FOUND) +if(HAVE_APR_CONFIG) + find_path(LIBSVN_INCLUDE_DIR svn_client.h + HINTS + $ENV{LIBSVN_DIR} + PATH_SUFFIXES include/subversion-1 + PATHS + /usr/local + /usr + /opt + ) + + check_library_exists(svn_client-1 svn_client_checkout "" HAVE_LIB_SVNCLIENT) + check_library_exists(svn_subr-1 svn_cmdline_init "" HAVE_LIB_SVNSUBR) + check_library_exists(svn_ra-1 svn_ra_initialize "" HAVE_LIB_SVNRA) + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG + HAVE_LIB_SVNSUBR + HAVE_LIB_SVNCLIENT + HAVE_LIB_SVNRA + LIBSVN_INCLUDE_DIR) + + if(LIBSVN_FOUND) + set(LIBSVN_LIBRARIES "svn_client-1" "svn_subr-1" "svn_ra-1" ${APR_LIBS}) + endif(LIBSVN_FOUND) +endif(HAVE_APR_CONFIG) + diff --git a/simgear/scene/tsync/CMakeLists.txt b/simgear/scene/tsync/CMakeLists.txt index 238e0b90..5c0be429 100644 --- a/simgear/scene/tsync/CMakeLists.txt +++ b/simgear/scene/tsync/CMakeLists.txt @@ -8,4 +8,15 @@ set(SOURCES terrasync.cxx ) +if(LIBSVN_FOUND) + add_definitions(${APR_CFLAGS}) + + IF(APPLE) + set_property(SOURCE terrasync.cxx PROPERTY COMPILE_FLAGS "-iwithsysroot ${LIBSVN_INCLUDE_DIR}") + ELSE() + include_directories(${LIBSVN_INCLUDE_DIR}) + ENDIF(APPLE) + +endif() + simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}") diff --git a/simgear/simgear_config_cmake.h.in b/simgear/simgear_config_cmake.h.in index 2bc95fb3..bfb4b1b9 100644 --- a/simgear/simgear_config_cmake.h.in +++ b/simgear/simgear_config_cmake.h.in @@ -12,5 +12,8 @@ #cmakedefine HAVE_ISNAN #cmakedefine HAVE_WINDOWS_H +#cmakedefine HAVE_SVN_CLIENT_H +#cmakedefine HAVE_LIBSVN_CLIENT_1 + // set if building headless (no OSG or OpenGL libs) #cmakedefine NO_OPENSCENEGRAPH_INTERFACE -- 2.39.5