1 # - Find the Poco includes and libraries.
2 # The following variables are set if Poco is found. If Poco is not
3 # found, Poco_FOUND is set to false.
4 # Poco_FOUND - True when the Poco include directory is found.
5 # Poco_INCLUDE_DIRS - the path to where the poco include files are.
6 # Poco_LIBRARY_DIRS - The path to where the poco library files are.
7 # Poco_BINARY_DIRS - The path to where the poco dlls are.
9 # ----------------------------------------------------------------------------
10 # If you have installed Poco in a non-standard location.
11 # Then you have three options.
12 # In the following comments, it is assumed that <Your Path>
13 # points to the root directory of the include directory of Poco. e.g
14 # If you have put poco in C:\development\Poco then <Your Path> is
15 # "C:/development/Poco" and in this directory there will be two
16 # directories called "include" and "lib".
17 # 1) After CMake runs, set Poco_INCLUDE_DIR to <Your Path>/poco<-version>
18 # 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/poco<-version>. This will allow find_path()
19 # to locate Poco_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g.
20 # set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
21 # 3) Set an environment variable called ${POCO_ROOT} that points to the root of where you have
22 # installed Poco, e.g. <Your Path>. It is assumed that there is at least a subdirectory called
23 # Foundation/include/Poco in this path.
26 # 1) If you are just using the poco headers, then you do not need to use
27 # Poco_LIBRARY_DIR in your CMakeLists.txt file.
28 # 2) If Poco has not been installed, then when setting Poco_LIBRARY_DIR
29 # the script will look for /lib first and, if this fails, then for /stage/lib.
32 # In your CMakeLists.txt file do something like this:
37 # include_directories(${Poco_INCLUDE_DIRS})
38 # link_directories(${Poco_LIBRARY_DIR})
40 # In Windows, we make the assumption that, if the Poco files are installed, the default directory
41 # will be C:\poco or C:\Program Files\Poco or C:\Programme\Poco.
43 set(POCO_INCLUDE_PATH_DESCRIPTION "top-level directory containing the poco include directories.")
44 set(POCO_INCLUDE_DIR_MESSAGE "Set the Poco_INCLUDE_DIR cmake cache entry to the ${POCO_INCLUDE_PATH_DESCRIPTION}")
45 set(POCO_LIBRARY_PATH_DESCRIPTION "directory containing the poco libraries:")
48 set(POCO_DIR_SEARCH $ENV{POCO_ROOT})
50 file(TO_CMAKE_PATH ${POCO_DIR_SEARCH} POCO_DIR_SEARCH)
51 endif(POCO_DIR_SEARCH)
52 list(APPEND POCO_DIR_SEARCH ${Poco_DIR})
59 "C:/Program Files/poco"
61 "D:/Program Files/poco"
66 # Add in some path suffixes. These will have to be updated whenever a new Poco version comes out.
67 set(SUFFIX_FOR_INCLUDE_PATH
71 set(SUFFIX_FOR_LIBRARY_PATH
77 # Look for an installation.
79 find_path(Poco_INCLUDE_DIR NAMES Poco/Poco.h PATH_SUFFIXES ${SUFFIX_FOR_INCLUDE_PATH} PATHS
81 # Look in other places.
84 # Help the user find it if we cannot.
85 DOC "The ${POCO_INCLUDE_PATH_DESCRIPTION}"
88 if(NOT Poco_INCLUDE_DIR)
90 # Look for standard unix include paths
91 find_path(Poco_INCLUDE_DIR Poco/Poco.h DOC "The ${POCO_INCLUDE_PATH_DESCRIPTION}")
93 endif(NOT Poco_INCLUDE_DIR)
95 # Assume we didn't find it.
99 set(Poco_LIBRARY_DIRS )
101 # Now try to get the include and library path.
102 # Find all libraries, store debug and release separately
119 # Find Release libraries
120 find_library(Poco_${lib}_LIBRARY_RELEASE
122 PATH_SUFFIXES ${SUFFIX_FOR_LIBRARY_PATH}
123 PATHS ${POCO_DIR_SEARCH}
124 DOC "The ${POCO_LIBRARY_PATH_DESCRIPTION} Poco${lib}"
127 # Find Debug libraries
128 find_library(Poco_${lib}_LIBRARY_DEBUG
130 PATH_SUFFIXES ${SUFFIX_FOR_LIBRARY_PATH}
131 PATHS ${POCO_DIR_SEARCH}
132 DOC "The ${POCO_LIBRARY_PATH_DESCRIPTION} Poco${lib}d"
135 mark_as_advanced(Poco_${lib}_LIBRARY_RELEASE)
136 mark_as_advanced(Poco_${lib}_LIBRARY_DEBUG)
138 # Add libraries to variable according to build type
139 set(Poco_${lib}_LIBRARY)
140 if(Poco_${lib}_LIBRARY_RELEASE)
141 list(APPEND Poco_LIBRARIES optimized ${Poco_${lib}_LIBRARY_RELEASE})
142 list(APPEND Poco_${lib}_LIBRARY optimized ${Poco_${lib}_LIBRARY_RELEASE})
143 get_filename_component(lib_dir ${Poco_${lib}_LIBRARY_RELEASE} PATH)
144 list(APPEND Poco_LIBRARY_DIRS ${lib_dir})
147 if(Poco_${lib}_LIBRARY_DEBUG)
148 list(APPEND Poco_LIBRARIES debug ${Poco_${lib}_LIBRARY_DEBUG})
149 list(APPEND Poco_${lib}_LIBRARY debug ${Poco_${lib}_LIBRARY_DEBUG})
150 get_filename_component(lib_dir ${Poco_${lib}_LIBRARY_RELEASE} PATH)
151 list(APPEND Poco_LIBRARY_DIRS ${lib_dir})
156 if(Poco_LIBRARY_DIRS)
157 list(REMOVE_DUPLICATES Poco_LIBRARY_DIRS)
160 set(Poco_INCLUDE_DIRS ${Poco_INCLUDE_DIR})
162 include(FindPackageHandleStandardArgs)
163 find_package_handle_standard_args(Poco DEFAULT_MSG
165 Poco_Foundation_LIBRARY