Commit a563705e authored by David Narváez's avatar David Narváez
Browse files

Stylistic changes to FindBoostPython.cmake and framework

Polish FindBoostPython.cmake from CMake's point of view:

 * Use BoostPython_ prefix instead of BOOST_PYTHON_
   (BOOSTPYTHON_ is also acceptable but is unreadable);

 * Remove extra call to find_package(BoostPython);

 * Replace macro_optional_find_package() with simple find_package(),
   CMake has CMAKE_DISABLE_FIND_PACKAGE_Foo feature for a while.

This is a first patch of a bigger set, containing only minor fixes.

CCBUG: 320807
REVIEW: 110953
parent 36a93869
......@@ -25,10 +25,10 @@ include(MacroBoolTo01)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
find_package(BoostPython)
kde4_no_enable_final(kig)
find_package(BoostPython)
include(KigConfigureChecks.cmake)
add_subdirectory( doc )
......@@ -40,16 +40,16 @@ add_subdirectory( macros )
#add_subdirectory( kfile )
add_subdirectory( data )
add_subdirectory( pykig )
if(BOOST_PYTHON_FOUND)
if(BoostPython_FOUND)
add_subdirectory( scripting )
endif(BOOST_PYTHON_FOUND)
endif(BoostPython_FOUND)
macro_display_feature_log()
include_directories( ${CMAKE_SOURCE_DIR}/modes )
if(BOOST_PYTHON_FOUND)
include_directories(${BOOST_PYTHON_INCLUDES})
endif(BOOST_PYTHON_FOUND)
if(BoostPython_FOUND)
include_directories(${BoostPython_INCLUDE_DIRS})
endif(BoostPython_FOUND)
# kigpart
......@@ -178,7 +178,7 @@ kde4_add_ui_files(kigpart_PART_SRCS
misc/kigcoordinateprecisiondialog.ui
)
if(BOOST_PYTHON_FOUND)
if(BoostPython_FOUND)
set(kigpart_PART_SRCS ${kigpart_PART_SRCS}
modes/popup/scriptactionsprovider.cc
scripting/newscriptwizard.cc
......@@ -189,18 +189,27 @@ if(BOOST_PYTHON_FOUND)
)
set_source_files_properties(scripting/python_scripter.cc PROPERTIES COMPILE_FLAGS "${KDE4_ENABLE_EXCEPTIONS}")
endif(BOOST_PYTHON_FOUND)
endif(BoostPython_FOUND)
kde4_add_plugin(kigpart ${kigpart_PART_SRCS})
target_link_libraries(kigpart ${KDE4_KPARTS_LIBS} ${KDE4_KUTILS_LIBS} )
if(BOOST_PYTHON_FOUND)
target_link_libraries(kigpart ${BOOST_PYTHON_LIBS} ${KDE4_KTEXTEDITOR_LIBS})
endif(BOOST_PYTHON_FOUND)
if(BoostPython_FOUND)
target_link_libraries(kigpart ${BoostPython_LIBRARIES} ${KDE4_KTEXTEDITOR_LIBS})
endif(BoostPython_FOUND)
install(TARGETS kigpart DESTINATION ${PLUGIN_INSTALL_DIR})
macro_log_feature(
BoostPython_FOUND
"Boost.Python"
"Kig can optionally use Boost.Python for Python scripting"
"http://www.boost.org/"
FALSE
"1.31"
""
)
# unit tests
add_subdirectory(tests)
......@@ -9,21 +9,10 @@ check_function_exists(trunc HAVE_TRUNC)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
macro_optional_find_package(BoostPython)
# at the end, output the configuration
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-kig.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-kig.h
)
macro_log_feature(
BOOST_PYTHON_FOUND
"Boost.Python"
"Kig can optionally use Boost.Python for Python scripting"
"http://www.boost.org/"
FALSE
"1.31"
""
)
# - Try to find the a valid boost+python combination
# Once done this will define
#
# BOOST_PYTHON_FOUND - system has a valid boost+python combination
# BOOST_PYTHON_INCLUDES - the include directory for boost+python
# BOOST_PYTHON_LIBS - the needed libs for boost+python
# BoostPython_FOUND - system has a valid boost+python combination
# BoostPython_INCLUDE_DIRS - the include directory for boost+python
# BoostPython_LIBRARIES - the needed libs for boost+python
# Copyright (c) 2006, Pino Toscano, <toscano.pino@tiscali.it>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
if(BoostPython_INCLUDE_DIRS AND BoostPython_LIBRARIES)
# Already in cache, be silent
set(BOOST_PYTHON_FIND_QUIETLY TRUE)
endif(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
set(BoostPython_FIND_QUIETLY TRUE)
endif(BoostPython_INCLUDE_DIRS AND BoostPython_LIBRARIES)
include(CheckIncludeFileCXX)
find_package(PkgConfig)
# reset vars
set(BOOST_PYTHON_INCLUDES)
set(BOOST_PYTHON_LIBS)
set(BoostPython_INCLUDE_DIRS)
set(BoostPython_LIBRARIES)
# handy arrays
set(PYTHON_VERSIONS "python;python2.7;python2.6;python2.5;python2.4;python2.3;python2.2")
......@@ -37,11 +37,11 @@ if(HAVE_BOOST_SHARED_PTR_HPP)
if(NOT _found)
pkg_check_modules(_python QUIET ${_pyver})
if (_python_FOUND)
find_package(Boost 1.33 COMPONENTS python)
find_package(Boost 1.31 COMPONENTS python)
if (Boost_PYTHON_FOUND)
set(_found TRUE)
set(BOOST_PYTHON_INCLUDES "${_python_INCLUDE_DIRS};${Boost_INCLUDE_DIRS}")
set(BOOST_PYTHON_LIBS "${_python_LDFLAGS} ${Boost_PYTHON_LIBRARY}")
set(BoostPython_INCLUDE_DIRS "${_python_INCLUDE_DIRS};${Boost_INCLUDE_DIRS}")
set(BoostPython_LIBRARIES "${_python_LDFLAGS} ${Boost_PYTHON_LIBRARY}")
endif(Boost_PYTHON_FOUND)
endif(_python_FOUND)
endif(NOT _found)
......@@ -49,20 +49,20 @@ if(HAVE_BOOST_SHARED_PTR_HPP)
endif(HAVE_BOOST_SHARED_PTR_HPP)
if(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
set(BOOST_PYTHON_FOUND TRUE)
endif(BOOST_PYTHON_INCLUDES AND BOOST_PYTHON_LIBS)
if(BoostPython_INCLUDE_DIRS AND BoostPython_LIBRARIES)
set(BoostPython_FOUND TRUE)
endif(BoostPython_INCLUDE_DIRS AND BoostPython_LIBRARIES)
if(BOOST_PYTHON_FOUND)
if(BoostPython_FOUND)
if(NOT BoostPython_FIND_QUIETLY)
message(STATUS "Found Boost+Python: libs ${BOOST_PYTHON_LIBS}, headers ${BOOST_PYTHON_INCLUDES}")
message(STATUS "Found Boost+Python: libs ${BoostPython_LIBRARIES}, headers ${BoostPython_INCLUDE_DIRS}")
endif(NOT BoostPython_FIND_QUIETLY)
set(KIG_ENABLE_PYTHON_SCRIPTING 1)
else (BOOST_PYTHON_FOUND)
else (BoostPython_FOUND)
if (BoostPython_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find Boost+Python")
endif(BoostPython_FIND_REQUIRED)
set(KIG_ENABLE_PYTHON_SCRIPTING 0)
endif(BOOST_PYTHON_FOUND)
endif(BoostPython_FOUND)
mark_as_advanced(BOOST_PYTHON_INCLUDES BOOST_PYTHON_LIBS)
mark_as_advanced(BoostPython_INCLUDE_DIRS BoostPython_LIBRARIES)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment