From 6b045c3ba8be63fbb3cd8dc026e984184696730c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85dne=20Hovda?= Date: Tue, 18 Nov 2014 21:47:02 +0100 Subject: ccmake: Add CMAKE_USE_SYSTEM_FORM option to use libform instead of cmForm --- CMakeLists.txt | 9 +++++++-- Source/CursesDialog/CMakeLists.txt | 18 +++++++++++++++--- Utilities/cmThirdParty.h.in | 1 + 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58e0a1f..ba7f129 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) # Allow the user to enable/disable all system utility library options by # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. - set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE LIBLZMA ZLIB) + set(UTILITIES BZIP2 CURL EXPAT FORM LIBARCHIVE LIBLZMA ZLIB) foreach(util ${UTILITIES}) if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES) @@ -95,6 +95,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma" "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) + option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}") # Mention to the user what system libraries are being used. foreach(util ${UTILITIES}) @@ -394,7 +395,11 @@ macro (CMAKE_BUILD_UTILITIES) set(BUILD_CursesDialog 0) endif () if(BUILD_CursesDialog) - add_subdirectory(Source/CursesDialog/form) + if(NOT CMAKE_USE_SYSTEM_FORM) + add_subdirectory(Source/CursesDialog/form) + elseif(NOT CURSES_FORM_LIBRARY) + message( FATAL_ERROR "CMAKE_USE_SYSTEM_FORM in ON but CURSES_FORM_LIBRARY is not set!" ) + endif() endif() endmacro () diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 548f5a5..7d4e88c 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -26,13 +26,25 @@ set( CURSES_SRCS CursesDialog/ccmake ) -include_directories(${CMake_SOURCE_DIR}/Source/CursesDialog/form - ${CMake_BINARY_DIR}/Source/CursesDialog/form) +if( NOT CMAKE_USE_SYSTEM_FORM ) + include_directories(${CMake_SOURCE_DIR}/Source/CursesDialog/form + ${CMake_BINARY_DIR}/Source/CursesDialog/form) +endif() include_directories(${CURSES_INCLUDE_PATH}) add_executable(ccmake ${CURSES_SRCS} ) target_link_libraries(ccmake CMakeLib) -target_link_libraries(ccmake cmForm) +if(CMAKE_USE_SYSTEM_FORM) + target_link_libraries(ccmake + ${CURSES_FORM_LIBRARY} + ${CURSES_LIBRARY} + ) + if(CURSES_EXTRA_LIBRARY) + target_link_libraries(ccmake ${CURSES_EXTRA_LIBRARY}) + endif() +else() + target_link_libraries(ccmake cmForm) +endif() install(TARGETS ccmake DESTINATION bin) diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index b0b5779..726c843 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -19,6 +19,7 @@ #cmakedefine CMAKE_USE_SYSTEM_BZIP2 #cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE #cmakedefine CMAKE_USE_SYSTEM_LIBLZMA +#cmakedefine CMAKE_USE_SYSTEM_FORM #cmakedefine CTEST_USE_XMLRPC #endif -- cgit v0.12