summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-08-16 15:02:59 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:08 -0300
commit20c9b77b712211f6d04c0166c78f579e19869473 (patch)
tree06c6d0089736e1f30529b1527440f384ef31ecc8
parent900370cf73a8ad8bd2b61285123ddc0089452089 (diff)
Make libxml2 and libxslt optional dependencies.
-rw-r--r--ApiExtractorConfig.cmake.in4
-rw-r--r--CMakeLists.txt34
-rw-r--r--tests/CMakeLists.txt4
3 files changed, 32 insertions, 10 deletions
diff --git a/ApiExtractorConfig.cmake.in b/ApiExtractorConfig.cmake.in
index 6c4001ff..f36c13f8 100644
--- a/ApiExtractorConfig.cmake.in
+++ b/ApiExtractorConfig.cmake.in
@@ -7,4 +7,6 @@ if(MSVC)
SET(APIEXTRACTOR_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@apiextractor.lib")
else()
SET(APIEXTRACTOR_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@apiextractor@CMAKE_SHARED_LIBRARY_SUFFIX@")
-endif() \ No newline at end of file
+endif()
+
+SET(APIEXTRACTOR_DOCSTRINGS_DISABLED @DISABLE_DOCSTRINGS@)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9d2de1f..aa1e61ff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,11 +4,19 @@ cmake_minimum_required(VERSION 2.6)
find_package(Qt4 4.5.0 REQUIRED)
-find_package(LibXml2 2.6.32 REQUIRED)
-find_package(LibXslt 1.1.19 REQUIRED)
+find_package(LibXml2 2.6.32)
+find_package(LibXslt 1.1.19)
+option(DISABLE_DOCSTRINGS "Disable documentation extraction." FALSE)
option(BUILD_TESTS "Build tests." TRUE)
+if (NOT DISABLE_DOCSTRINGS)
+ if (NOT LIBXSLT_FOUND OR NOT LIBXML2_FOUND)
+ set(DISABLE_DOCSTRINGS TRUE)
+ message(WARNING "libxslt and/or libxml not found, disabling support to doc strings!")
+ endif()
+endif()
+
if(MSVC)
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /w /EHsc- /GS- /GR- /DAPIEXTRACTOR_BUILD -D_SCL_SECURE_NO_WARNINGS")
elseif(CMAKE_HOST_UNIX)
@@ -54,9 +62,6 @@ apiextractor.cpp
abstractmetabuilder.cpp
abstractmetalang.cpp
asttoxml.cpp
-docparser.cpp
-doxygenparser.cpp
-qtdocparser.cpp
fileout.cpp
graph.cpp
reporthandler.cpp
@@ -86,6 +91,20 @@ parser/rpp/builtin-macros.cpp
parser/rpp/preprocessor.cpp
)
+if (NOT DISABLE_DOCSTRINGS)
+ set(apiextractor_SRC
+ ${apiextractor_SRC}
+ docparser.cpp
+ doxygenparser.cpp
+ qtdocparser.cpp
+ )
+ set(APIEXTRACTOR_EXTRA_INCLUDES ${LIBXSLT_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})
+ set(APIEXTRACTOR_EXTRA_LIBRARIES ${LIBXSLT_LIBRARIES} ${LIBXML2_LIBRARIES})
+else()
+ set(APIEXTRACTOR_EXTRA_INCLUDES "")
+ set(APIEXTRACTOR_EXTRA_LIBRARIES "")
+endif()
+
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
qt4_add_resources(apiextractor_RCCS_SRC generator.qrc)
@@ -96,12 +115,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/parser
${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp
${QT_INCLUDE_DIR}
- ${LIBXSLT_INCLUDE_DIR}
- ${LIBXML2_INCLUDE_DIR}
+ ${APIEXTRACTOR_EXTRA_INCLUDES}
)
add_library(apiextractor SHARED ${apiextractor_SRC} ${apiextractor_RCCS_SRC})
-target_link_libraries(apiextractor ${LIBXSLT_LIBRARIES} ${LIBXML2_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTXMLPATTERNS_LIBRARY} ${QT_QTXML_LIBRARY})
+target_link_libraries(apiextractor ${APIEXTRACTOR_EXTRA_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTXMLPATTERNS_LIBRARY} ${QT_QTXML_LIBRARY})
set_target_properties(apiextractor PROPERTIES VERSION ${apiextractor_VERSION} SOVERSION ${apiextractor_SOVERSION})
# create pkg-config file
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index debccf3c..acd9fcc9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -18,7 +18,9 @@ declare_test(testdtorinformation)
declare_test(testenum)
declare_test(testfunctiontag)
declare_test(testimplicitconversions)
-declare_test(testmodifydocumentation)
+if (NOT DISABLE_DOCSTRINGS)
+ declare_test(testmodifydocumentation)
+endif()
declare_test(testmodifyfunction)
declare_test(testmultipleinheritance)
declare_test(testnamespace)