ccmake: Add CMAKE_USE_SYSTEM_FORM option to use libform instead of cmForm

This commit is contained in:
Ådne Hovda 2014-11-18 21:47:02 +01:00 committed by Brad King
parent 66ba7ea831
commit 6b045c3ba8
3 changed files with 23 additions and 5 deletions

View File

@ -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 ()

View File

@ -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)

View File

@ -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