added poco find files

This commit is contained in:
Jonas Zeunert
2019-07-30 21:07:25 +02:00
parent 9cc3a7eb91
commit 2418a876fb
8 changed files with 290 additions and 9 deletions

View File

@@ -0,0 +1,53 @@
if (CMAKE_VERSION VERSION_LESS 2.8.9)
message(FATAL_ERROR "Poco requires at least CMake version 2.8.9")
endif()
if (NOT Poco_FIND_COMPONENTS)
set(Poco_NOT_FOUND_MESSAGE "The Poco package requires at least one component")
set(Poco_FOUND False)
return()
endif()
set(_Poco_FIND_PARTS_REQUIRED)
if (Poco_FIND_REQUIRED)
set(_Poco_FIND_PARTS_REQUIRED REQUIRED)
endif()
set(_Poco_FIND_PARTS_QUIET)
if (Poco_FIND_QUIETLY)
set(_Poco_FIND_PARTS_QUIET QUIET)
endif()
get_filename_component(_Poco_install_prefix "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
set(_Poco_NOTFOUND_MESSAGE)
# Let components find each other, but don't overwrite CMAKE_PREFIX_PATH
set(_Poco_CMAKE_PREFIX_PATH_old ${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${_Poco_install_prefix})
foreach(module ${Poco_FIND_COMPONENTS})
find_package(Poco${module}
${_Poco_FIND_PARTS_QUIET}
${_Poco_FIND_PARTS_REQUIRED}
PATHS "${_Poco_install_prefix}" NO_DEFAULT_PATH
)
if (NOT Poco${module}_FOUND)
if (Poco_FIND_REQUIRED_${module})
set(_Poco_NOTFOUND_MESSAGE "${_Poco_NOTFOUND_MESSAGE}Failed to find Poco component \"${module}\" config file at \"${_Poco_install_prefix}/Poco${module}/Poco${module}Config.cmake\"\n")
elseif(NOT Poco_FIND_QUIETLY)
message(WARNING "Failed to find Poco component \"${module}\" config file at \"${_Poco_install_prefix}/Poco${module}/Poco${module}Config.cmake\"")
endif()
endif()
# For backward compatibility set the LIBRARIES variable
list(APPEND Poco_LIBRARIES "Poco::${module}")
endforeach()
# Restore the original CMAKE_PREFIX_PATH value
set(CMAKE_PREFIX_PATH ${_Poco_CMAKE_PREFIX_PATH_old})
if (_Poco_NOTFOUND_MESSAGE)
set(Poco_NOT_FOUND_MESSAGE "${_Poco_NOTFOUND_MESSAGE}")
set(Poco_FOUND False)
endif()

View File

@@ -0,0 +1,11 @@
set(PACKAGE_VERSION @APPLICATION_VERSION@)
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

View File

@@ -0,0 +1,36 @@
CMAKE Files contributed by Andrew J. P. Maclean <a.maclean@optusnet.com.au>
Put the following files in the directory where your source code is:
CMakeLists.txt
PocoConfig.cmake.
Edit CMakeLists.txt to include your source and header files. The sections of interest are:
# Add any source files here.
SET( EXE_SRCS
"My File.cpp"
)
# Add any include files here.
SET( EXE_INCS
"My File.h"
)
Then create a subdirectory called build.
In Linux:
cd build
ccmake ..
or
ccmake -GKDevelop3 ..
(This will set up everything so you can use KDevelop3).
In Windows:
run CMakeSetup.exe and set the source code directory and where to build the libraries.
If CMake cannot find Poco, you will see that the variable Poco_INCLUDE_DIR has the value Poco_INCLUDE_DIR-NOTFOUND. Just set this value to the top level direcotry of where the Poco includes are.
If there is a different version of Poco, you may have to add edit the variables SUFFIX_FOR_INCLUDE_PATH, and SUFFIX_FOR_LIBRARY_PATH adding in the new Poco version in a similar manner to the existing ones in the file PocoConfig.cmake.
Finally:
In Linux
Either type "make" or if you are using KDevelop, click on the <ProjectName>.kdevelop file.
In Windows just use your IDE or nmake if you use nmake.

View File

@@ -0,0 +1,22 @@
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF("${rm_retval}" STREQUAL 0)
ELSE("${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF("${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)

View File

@@ -0,0 +1,9 @@
#include <iostream>
#include <string>
int main()
{
std::string str = "Try to compile";
std::cout << str << '\n';
return 0;
}