Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 64d81eac7e029f2a905da9d0d46257e8 > files > 1

scite-1.79-5mdv2010.1.src.rpm

#vim: set shiftwidth=4 tabstop=4 smarttab noexpandtab foldmethod=marker textwidth=80:

# set cmake minimal version
cmake_minimum_required(VERSION 2.6)

# the project name
project(scite)

# Set informations for Debug and RelWithDebInfo build type
if (NOT CMAKE_BUILD_TYPE)
	message("-- Change build type with : cmake -DCMAKE_BUILD_TYPE=(Debug|Release|RelWithDebInfo|MinSizeRel) ..")
endif()

# find and setup Gtk2 for this project
#find_package(GTK2 REQUIRED) #require findgtk2.cmake
include(FindPkgConfig)
pkg_search_module(GTK2 REQUIRED gtk+-2.0)

if (NOT GTK2_FOUND)
	message(FATAL_ERROR "Unable to find gtk+-2.0")
else ()
	include_directories(${GTK2_INCLUDE_DIRS})
	add_definitions(${GTK2_DEFINITIONS})
	link_directories(${GTK2_LIBRARY_DIRS})
endif ()

FIND_LIBRARY(GTK2_GTHREAD_LIBRARIES
	NAMES  gthread2 gthread20 gthread2.0 gthread-20 gthread-2.0
	PATHS  /usr/openwin/lib /opt/gnome/lib
)

if (NOT GTK2_GTHREAD_LIBRARIES)
	message(FATAL_ERROR "Unable to find gthread-2.0")
endif ()

FIND_PACKAGE(Lua51 REQUIRED)
if (NOT LUA51_FOUND)
	message(FATAL_ERROR "Unable to find lua-5.1")
else ()
	include_directories(${LUA_INCLUDE_DIRS})
	add_definitions(${LUA_DEFINITIONS})
	link_directories(${LUA_LIBRARY_DIRS})
endif ()

pkg_search_module(SCINTILLA REQUIRED scintilla>=1.79)
if (NOT SCINTILLA_FOUND)
	message(FATAL_ERROR "Unable to find scintilla-1.79")
else ()
	include_directories(${SCINTILLA_INCLUDE_DIRS})
	add_definitions(${SCINTILLA_DEFINITIONS})
	link_directories(${SCINTILLA_LIBRARY_DIRS})
endif ()

# Don't use temporary file
add_definitions(-pipe)
# Re-add old build flags
add_definitions(-Wall)
add_definitions(-pedantic)
add_definitions(-DGTK)
add_definitions(-DSCI_LEXER)
add_definitions(-DPIXMAP_PATH="${SHARE_INSTALL_PREFIX}/pixmaps")
add_definitions(-DSYSCONF_PATH="${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}")

# inclusion de la source de destination
include_directories(${scite_SOURCE_DIR}/include)
include_directories(${scite_SOURCE_DIR}/src)

# create a library from the sources files.
file(GLOB_RECURSE scite_SRCS ${scite_SOURCE_DIR}/gtk/*.cxx ${scite_SOURCE_DIR}/src/*.cxx ${scite_SOURCE_DIR}/gtk/*.c)
add_executable(SciTE ${scite_SRCS})
target_link_libraries(SciTE ${GTK2_LIBRARIES} ${GTK2_GTHREAD_LIBRARIES} ${LUA_LIBRARIES} ${SCINTILLA_LIBRARIES})

# install the generated binary
install(TARGETS SciTE DESTINATION bin)

# install scite shared files
file(GLOB_RECURSE scite_PRTS ${scite_SOURCE_DIR}/src/*.properties)
install(FILES ${scite_PRTS} DESTINATION ${SHARE_INSTALL_PREFIX}/${PROJECT_NAME})
install(FILES gtk/SciTE.desktop DESTINATION ${SHARE_INSTALL_PREFIX}/applications)
install(FILES gtk/Sci48M.png DESTINATION ${SHARE_INSTALL_PREFIX}/pixmaps)
install(FILES doc/${PROJECT_NAME}.1 DESTINATION ${SHARE_INSTALL_PREFIX}/man/man1)