]> git.mxchange.org Git - flightgear.git/blob - CMakeModules/FindSvnClient.cmake
Fix SVN detection for Windows
[flightgear.git] / CMakeModules / FindSvnClient.cmake
1 # Find Subversion client libraries, and dependencies
2 # including APR (Apache Portable Runtime)
3
4 include (CheckFunctionExists)
5 include (CheckIncludeFile)
6 include (CheckLibraryExists)
7
8 find_program(HAVE_APR_CONFIG apr-1-config)
9 if(HAVE_APR_CONFIG) 
10         
11     execute_process(COMMAND apr-1-config --cppflags --includes
12         OUTPUT_VARIABLE APR_CFLAGS
13         OUTPUT_STRIP_TRAILING_WHITESPACE)
14         
15     execute_process(COMMAND apr-1-config --link-ld
16         OUTPUT_VARIABLE RAW_APR_LIBS
17         OUTPUT_STRIP_TRAILING_WHITESPACE)
18     
19 # clean up some vars, or other CMake pieces complain
20         string(STRIP "${RAW_APR_LIBS}" APR_LIBS)
21
22 else(HAVE_APR_CONFIG)
23     message(STATUS "apr-1-config not found, implement manual search for APR")
24 endif(HAVE_APR_CONFIG)
25
26 if(HAVE_APR_CONFIG OR MSVC)
27         find_path(LIBSVN_INCLUDE_DIR svn_client.h
28           HINTS
29           $ENV{LIBSVN_DIR}
30           PATH_SUFFIXES include/subversion-1
31           PATHS
32           /usr/local
33           /usr
34           /opt
35         )
36
37         if (MSVC)
38                 check_library_exists(libsvn_client-1 svn_client_checkout "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNCLIENT)
39                 check_library_exists(libsvn_subr-1 svn_cmdline_init "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNSUBR)
40                 check_library_exists(libsvn_ra-1 svn_ra_initialize "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNRA)
41         else (MSVC)
42                 check_library_exists(svn_client-1 svn_client_checkout "" HAVE_LIB_SVNCLIENT)
43                 check_library_exists(svn_subr-1 svn_cmdline_init "" HAVE_LIB_SVNSUBR)
44                 check_library_exists(svn_ra-1 svn_ra_initialize "" HAVE_LIB_SVNRA)
45         endif (MSVC)
46
47         include(FindPackageHandleStandardArgs)
48         FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG 
49                 HAVE_LIB_SVNSUBR 
50                 HAVE_LIB_SVNCLIENT
51                 HAVE_LIB_SVNRA 
52                 LIBSVN_INCLUDE_DIR)
53
54         if(LIBSVN_FOUND)
55                 set(LIBSVN_LIBRARIES "svn_client-1" "svn_subr-1" "svn_ra-1" ${APR_LIBS})
56         endif(LIBSVN_FOUND)
57 endif(HAVE_APR_CONFIG OR MSVC)