summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-03-06 10:39:41 (GMT)
committerGitHub <noreply@github.com>2017-03-06 10:39:41 (GMT)
commitdf4c0274650a7a40a043d99cac8a79185a4156f0 (patch)
treed97b173122429f30e1349bb14ba3d3d6de974414
parent8309a44ea39608f3e2adb60e7cad3e03fa2b1df6 (diff)
parent7006652c1009742b505bb865e2d799b2ad3d74b2 (diff)
downloaduscxml-df4c0274650a7a40a043d99cac8a79185a4156f0.zip
uscxml-df4c0274650a7a40a043d99cac8a79185a4156f0.tar.gz
uscxml-df4c0274650a7a40a043d99cac8a79185a4156f0.tar.bz2
Merge pull request #105 from gabm/ExternalURIParser
Problem: UriParser cannot be used from external source
-rw-r--r--CMakeLists.txt27
-rw-r--r--contrib/cmake/Finduriparser.cmake13
2 files changed, 31 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd14bda..8a5bbbd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -304,16 +304,23 @@ if (UNIX)
list (APPEND USCXML_CORE_LIBS "pthread")
endif()
+
# uriparser
-include("${CMAKE_MODULE_PATH}/BuildURIParser.cmake")
-message(STATUS "Did not look for UriParser")
-message(STATUS "--> will download and compile")
-if (URIPARSER_BUILT)
- include_directories(${URIPARSER_INCLUDE_DIR})
- list (APPEND USCXML_CORE_LIBS ${URIPARSER_LIBRARY})
- list (APPEND USCXML_PREREQS uriparser)
+find_package(uriparser)
+if(URIPARSER_FOUND)
+ include_directories(${URIPARSER_INCLUDE_DIRS})
+ list (APPEND USCXML_CORE_LIBS ${URIPARSER_LIBRARIES})
else()
- message(FATAL_ERROR "Could not build uriparser")
+ message(STATUS "Did not find UriParser")
+ message(STATUS "--> will download and compile")
+ include("${CMAKE_MODULE_PATH}/BuildURIParser.cmake")
+ if (URIPARSER_BUILT)
+ include_directories(${URIPARSER_INCLUDE_DIR})
+ list (APPEND USCXML_CORE_LIBS ${URIPARSER_LIBRARY})
+ list (APPEND USCXML_PREREQS uriparser)
+ else()
+ message(FATAL_ERROR "Could not find or build uriparser")
+ endif()
endif()
@@ -437,7 +444,9 @@ endif()
set_property(TARGET uscxml PROPERTY CXX_STANDARD 11)
set_property(TARGET uscxml PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET uscxml PROPERTY SOVERSION ${USCXML_VERSION})
-add_dependencies(uscxml ${USCXML_PREREQS})
+if (USCXML_PREREQS)
+ add_dependencies(uscxml ${USCXML_PREREQS})
+endif()
install_library(TARGETS uscxml)
diff --git a/contrib/cmake/Finduriparser.cmake b/contrib/cmake/Finduriparser.cmake
new file mode 100644
index 0000000..5c0668f
--- /dev/null
+++ b/contrib/cmake/Finduriparser.cmake
@@ -0,0 +1,13 @@
+find_path(URIPARSER_INCLUDE_DIR NAMES uriparser/UriBase.h)
+find_library(URIPARSER_LIBRARY NAMES uriparser)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(URIPARSER DEFAULT_MSG URIPARSER_LIBRARY URIPARSER_INCLUDE_DIR)
+
+if (URIPARSER_FOUND)
+ set(URIPARSER_LIBRARIES ${URIPARSER_LIBRARY})
+ set(URIPARSER_INCLUDE_DIRS ${URIPARSER_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(URIPARSER_INCLUDE_DIR)
+mark_as_advanced(URIPARSER_LIBRARY)