1 # Find Subversion client libraries, and dependencies
2 # including APR (Apache Portable Runtime)
4 include (CheckFunctionExists)
5 include (CheckIncludeFile)
6 include (CheckLibraryExists)
8 macro(find_static_component comp libs)
9 # account for alternative Windows svn distribution naming
11 set(compLib "lib${comp}")
13 set(compLib "${comp}")
16 string(TOUPPER "${comp}" compLibBase)
17 set( compLibName ${compLibBase}_LIBRARY )
19 FIND_LIBRARY(${compLibName}
22 PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
29 list(APPEND ${libs} ${${compLibName}})
32 find_program(HAVE_APR_CONFIG apr-1-config)
35 execute_process(COMMAND apr-1-config --cppflags --includes
36 OUTPUT_VARIABLE APR_CFLAGS
37 OUTPUT_STRIP_TRAILING_WHITESPACE)
39 execute_process(COMMAND apr-1-config --link-ld
40 OUTPUT_VARIABLE RAW_APR_LIBS
41 OUTPUT_STRIP_TRAILING_WHITESPACE)
43 # clean up some vars, or other CMake pieces complain
44 string(STRIP "${RAW_APR_LIBS}" APR_LIBS)
47 message(STATUS "apr-1-config not found, implement manual search for APR")
48 endif(HAVE_APR_CONFIG)
50 if(HAVE_APR_CONFIG OR MSVC)
51 find_path(LIBSVN_INCLUDE_DIR svn_client.h
54 PATH_SUFFIXES include/subversion-1
61 set(LIBSVN_LIBRARIES "")
63 find_static_component("apr-1" LIBSVN_LIBRARIES)
65 list(APPEND LIBSVN_LIBRARIES ${APR_LIBS})
67 find_static_component("svn_client-1" LIBSVN_LIBRARIES)
68 find_static_component("svn_subr-1" LIBSVN_LIBRARIES)
69 find_static_component("svn_ra-1" LIBSVN_LIBRARIES)
71 include(FindPackageHandleStandardArgs)
72 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG LIBSVN_LIBRARIES LIBSVN_INCLUDE_DIR)
74 set(LIBSVN_LIBRARIES "")
75 endif(NOT LIBSVN_FOUND)
76 endif(HAVE_APR_CONFIG OR MSVC)