mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 11:40:07 +00:00
optionally set a minimum required version
svn path=/trunk/KDE/kdegraphics/cmake/modules/; revision=747373
This commit is contained in:
parent
0f8848077e
commit
54e1a2b168
|
@ -11,6 +11,7 @@
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
|
include(CheckCSourceRuns)
|
||||||
|
|
||||||
if (LIBGS_LIBRARY)
|
if (LIBGS_LIBRARY)
|
||||||
# in cache already
|
# in cache already
|
||||||
|
@ -32,13 +33,44 @@ else (LIBGS_LIBRARY)
|
||||||
endif(LIBGS_LIBRARY)
|
endif(LIBGS_LIBRARY)
|
||||||
set(CMAKE_LIBRARY_PATH)
|
set(CMAKE_LIBRARY_PATH)
|
||||||
|
|
||||||
|
if (LIBGS_MINIMUM_VERSION)
|
||||||
|
string(REPLACE "." "" mingsver "${LIBGS_MINIMUM_VERSION}")
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES "${LIBGS_LIBRARY}")
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/spectre/libspectre")
|
||||||
|
check_c_source_runs("
|
||||||
|
#include <ghostscript/iapi.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
gsapi_revision_t gsrev;
|
||||||
|
|
||||||
|
if (gsapi_revision(&gsrev, sizeof(gsrev)) != 0)
|
||||||
|
return 1;
|
||||||
|
if (gsrev.revision < ${mingsver})
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
" HAVE_LIBGS_MINIMUM_VERSION)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
if (NOT HAVE_LIBGS_MINIMUM_VERSION)
|
||||||
|
set(LIBGS_FOUND FALSE)
|
||||||
|
endif (NOT HAVE_LIBGS_MINIMUM_VERSION)
|
||||||
|
endif (LIBGS_MINIMUM_VERSION)
|
||||||
|
|
||||||
|
if (LIBGS_MINIMUM_VERSION)
|
||||||
|
set(gsLibraryMessage " (v${LIBGS_MINIMUM_VERSION})")
|
||||||
|
else (LIBGS_MINIMUM_VERSION)
|
||||||
|
set(gsLibraryMessage "")
|
||||||
|
endif (LIBGS_MINIMUM_VERSION)
|
||||||
|
|
||||||
if (LIBGS_FOUND)
|
if (LIBGS_FOUND)
|
||||||
if (NOT LIBGS_FIND_QUIETLY)
|
if (NOT LIBGS_FIND_QUIETLY)
|
||||||
message(STATUS "Found the GS library: ${LIBGS_LIBRARY}")
|
message(STATUS "Found the GS library${gsLibraryMessage}: ${LIBGS_LIBRARY}")
|
||||||
endif (NOT LIBGS_FIND_QUIETLY)
|
endif (NOT LIBGS_FIND_QUIETLY)
|
||||||
else (LIBGS_FOUND)
|
else (LIBGS_FOUND)
|
||||||
if (LIBGS_FIND_REQUIRED)
|
if (LIBGS_FIND_REQUIRED)
|
||||||
message(FATAL_ERROR "Could NOT find the GS library")
|
message(FATAL_ERROR "Could NOT find the GS library${gsLibraryMessage}")
|
||||||
endif (LIBGS_FIND_REQUIRED)
|
endif (LIBGS_FIND_REQUIRED)
|
||||||
endif (LIBGS_FOUND)
|
endif (LIBGS_FOUND)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue