Hi Brad

Thanks a lot!

FWIW, I have attached a small patch which adds CMAKE_USE_SYSTEM_FORM enabling support for using libform.so as an alternative to the embedded cmForm library. I have tested it on RHEL and Ubuntu and it works fine. (Solaris also has libform, but using that results in a core dump). Nothing critical, obviously, but maybe distro packagers find it somewhat useful.

Best regards,
Ådne Hovda
>From 9c18272fd576a28e35e0913e3cb99c08b9fdd8bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85dne=20Hovda?= <[email protected]>
Date: Tue, 18 Nov 2014 21:47:02 +0100
Subject: [PATCH] Add CMAKE_USE_SYSTEM_FORM option for libform instead of
 embedded cmForm.

---
 CMakeLists.txt                     |  6 +++++-
 Source/CursesDialog/CMakeLists.txt | 18 +++++++++++++++---
 Utilities/cmThirdParty.h.in        |  1 +
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58e0a1f..6bd1e41 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 LIBARCHIVE LIBLZMA ZLIB FORM)
   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_LIBFORM}")
 
   # Mention to the user what system libraries are being used.
   foreach(util ${UTILITIES})
@@ -383,6 +384,9 @@ macro (CMAKE_BUILD_UTILITIES)
       find_package(Curses QUIET)
       if (CURSES_LIBRARY)
         option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
+        if(CMAKE_USE_SYSTEM_FORM AND NOT CURSES_FORM_LIBRARY)
+          message( FATAL_ERROR "CMAKE_USE_SYSTEM_FORM in ON but libform is not 
found!" )
+        endif()
       else ()
         message("Curses libraries were not found. Curses GUI for CMake will 
not be built.")
         set(BUILD_CursesDialog 0)
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
-- 
1.8.3.1

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to