Reworked some CMake code.

parent f112e444
......@@ -8,9 +8,17 @@ if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS_DEBUG "-ggdb")
endif(CMAKE_COMPILER_IS_GNUCC)
# Define search directories for AkabeiCore.
set(AKABEICORE_LIB_DIR ${LIB_INSTALL_DIR} CACHE PATH "AkabeiCore library files directory.")
set(AKABEICORE_INCLUDE_DIR ${INCLUDES_INSTALL_DIR} CACHE PATH "AkabeiCore library header files directory.")
# Define search directories for AkabeiClient.
set(AKABEICLIENT_LIB_DIR ${LIB_INSTALL_DIR} CACHE PATH "AkabeiClient library files directory.")
set(AKABEICLIENT_INCLUDE_DIR ${INCLUDES_INSTALL_DIR} CACHE PATH "AkabeiClient library header files directory.")
find_package(KDE4 REQUIRED)
find_package(AkabeiClient REQUIRED)
find_package(AkabeiCore REQUIRED)
find_package(AkabeiClient REQUIRED)
include (KDE4Defaults)
include (MacroLibrary)
......
# - Try to find the akabei core library
# Once done this will define
#
# AKABEICLIENT_FOUND - system has akabei core
# AKABEICLIENT_INCLUDE_DIR - the akabei core include directory
# AKABEICLIENT_LIBRARIES - Link these to use akabei core
# Copyright (c) 2007 Joris Guisson <joris.guisson@gmail.com> (This was based upon FindKTorrent.cmake)
# Copyright (c) 2007 Charles Connell <charles@connells.org> (This was based upon FindKopete.cmake)
# Copyright (c) 2010 Lukas Appelhans <l.appelhans@gmx.de>
# CMake module to locate the AkabeiClient library.
#
# Once done this will define:
#
# AKABEICLIENT_FOUND — System has AkabeiClient library.
# AKABEICLIENT_INCLUDE_DIR — AkabeiClient library include directory.
# AKABEICLIENT_LIBRARIES — Paths to the library files of the AkabeiClient library.
#
# Copyright © 2007 Joris Guisson <joris.guisson@gmail.com> (This was based upon FindKTorrent.cmake)
# Copyright © 2007 Charles Connell <charles@connells.org> (This was based upon FindKopete.cmake)
# Copyright © 2010 Lukas Appelhans <l.appelhans@gmx.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
# read from cache
set(AKABEICLIENT_FOUND TRUE)
else(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
# Search for the AkabeiClient library include path if not provided.
if(NOT AKABEICLIENT_INCLUDE_DIR)
FIND_PATH(AKABEICLIENT_INCLUDE_DIR
NAMES
......@@ -27,37 +46,57 @@ else(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
PATH_SUFFIXES
akabeiclient
)
FIND_LIBRARY(AKABEICLIENT_LIBRARIES
NAMES
akabeiclient
PATHS
${LIB_INSTALL_DIR}
)
if(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
set(AKABEICLIENT_FOUND TRUE)
endif(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
if(AKABEICLIENT_FOUND)
if(NOT AKABEICLIENT_FIND_QUIETLY)
message(STATUS "Found akabei client: ${AKABEICLIENT_LIBRARIES} ")
endif(NOT AKABEICLIENT_FIND_QUIETLY)
else(AKABEICLIENT_FOUND)
if(AKABEICLIENT_FIND_REQUIRED)
if(NOT AKABEICLIENT_INCLUDE_DIR)
message(FATAL_ERROR "Could not find akabei client includes.")
endif(NOT AKABEICLIENT_INCLUDE_DIR)
if(NOT AKABEICLIENT_LIBRARIES)
message(FATAL_ERROR "Could not find akabei client library.")
endif(NOT AKABEICLIENT_LIBRARIES)
else(AKABEICLIENT_FIND_REQUIRED)
if(NOT AKABEICLIENT_INCLUDE_DIR)
message(STATUS "Could not find akabei client includes.")
endif(NOT AKABEICLIENT_INCLUDE_DIR)
if(NOT AKABEICLIENT_LIBRARIES)
message(STATUS "Could not find akabei client library.")
endif(NOT AKABEICLIENT_LIBRARIES)
endif(AKABEICLIENT_FIND_REQUIRED)
endif(AKABEICLIENT_FOUND)
endif(NOT AKABEICLIENT_INCLUDE_DIR)
# Search for the AkabeiClient library files.
FIND_LIBRARY(AKABEICLIENT_LIBRARIES
NAMES
akabeiclient
PATHS
${AKABEICLIENT_LIB_DIR}
${LIB_INSTALL_DIR}
)
if(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
# Read from cache.
set(AKABEICLIENT_FOUND TRUE)
# Announce.
if(NOT AKABEICLIENT_FIND_QUIETLY)
message(STATUS "Looking for AkabeiClient library… FOUND.")
endif(NOT AKABEICLIENT_FIND_QUIETLY)
# Akabei could not be found.
else(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
message(STATUS "Looking for AkabeiClient library… NOT FOUND.")
function(MSG_AKABEI_INCLUDES SEVERITY)
message(${SEVERITY} " - Could not find AkabeiClient library header files.")
message(${SEVERITY} " Use AKABEICLIENT_INCLUDE_DIR to point to the directory where they are located.")
endfunction(MSG_AKABEI_INCLUDES)
function(MSG_AKABEI_LIBRARY SEVERITY)
message(${SEVERITY} " - Could not find AkabeiClient library files.")
message(${SEVERITY} " Use AKABEICLIENT_LIB_DIR to point to the directory where they are located.")
endfunction(MSG_AKABEI_LIBRARY)
if(AKABEICLIENT_FIND_REQUIRED)
if(NOT AKABEICLIENT_INCLUDE_DIR)
MSG_AKABEI_INCLUDES("FATAL_ERROR")
endif(NOT AKABEICLIENT_INCLUDE_DIR)
if(NOT AKABEICLIENT_LIBRARIES)
MSG_AKABEI_LIBRARY("FATAL_ERROR")
endif(NOT AKABEICLIENT_LIBRARIES)
else(AKABEICLIENT_FIND_REQUIRED)
if(NOT AKABEICLIENT_INCLUDE_DIR)
MSG_AKABEI_INCLUDES("STATUS")
endif(NOT AKABEICLIENT_INCLUDE_DIR)
if(NOT AKABEICLIENT_LIBRARIES)
MSG_AKABEI_LIBRARY("STATUS")
endif(NOT AKABEICLIENT_LIBRARIES)
endif(AKABEICLIENT_FIND_REQUIRED)
endif(AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES)
# - Try to find the akabei core library
# Once done this will define
#
# AKABEICORE_FOUND - system has akabei core
# AKABEICORE_INCLUDE_DIR - the akabei core include directory
# AKABEICORE_LIBRARIES - Link these to use akabei core
# Copyright (c) 2007 Joris Guisson <joris.guisson@gmail.com> (This was based upon FindKTorrent.cmake)
# Copyright (c) 2007 Charles Connell <charles@connells.org> (This was based upon FindKopete.cmake)
# Copyright (c) 2010 Lukas Appelhans <l.appelhans@gmx.de>
# CMake module to locate the AkabeiCore library.
#
# Once done this will define:
#
# AKABEICORE_FOUND — System has AkabeiCore library.
# AKABEICORE_INCLUDE_DIR — AkabeiCore library include directory.
# AKABEICORE_LIBRARIES — Paths to the library files of the AkabeiCore library.
#
# Copyright © 2007 Joris Guisson <joris.guisson@gmail.com> (This was based upon FindKTorrent.cmake)
# Copyright © 2007 Charles Connell <charles@connells.org> (This was based upon FindKopete.cmake)
# Copyright © 2010 Lukas Appelhans <l.appelhans@gmx.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
# read from cache
set(AKABEICORE_FOUND TRUE)
else(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
# Search for the AkabeiCore library include path if not provided.
if(NOT AKABEICORE_INCLUDE_DIR)
FIND_PATH(AKABEICORE_INCLUDE_DIR
NAMES
......@@ -27,37 +46,57 @@ else(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
PATH_SUFFIXES
akabeicore
)
FIND_LIBRARY(AKABEICORE_LIBRARIES
NAMES
akabeicore
PATHS
${LIB_INSTALL_DIR}
)
if(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
set(AKABEICORE_FOUND TRUE)
endif(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
if(AKABEICORE_FOUND)
if(NOT AKABEICORE_FIND_QUIETLY)
message(STATUS "Found akabei core: ${AKABEICORE_LIBRARIES} ")
endif(NOT AKABEICORE_FIND_QUIETLY)
else(AKABEICORE_FOUND)
if(AKABEICORE_FIND_REQUIRED)
if(NOT AKABEICORE_INCLUDE_DIR)
message(FATAL_ERROR "Could not find akabei core includes.")
endif(NOT AKABEICORE_INCLUDE_DIR)
if(NOT AKABEICORE_LIBRARIES)
message(FATAL_ERROR "Could not find akabei core library.")
endif(NOT AKABEICORE_LIBRARIES)
else(AKABEICORE_FIND_REQUIRED)
if(NOT AKABEICORE_INCLUDE_DIR)
message(STATUS "Could not find akabei core includes.")
endif(NOT AKABEICORE_INCLUDE_DIR)
if(NOT AKABEICORE_LIBRARIES)
message(STATUS "Could not find akabei core library.")
endif(NOT AKABEICORE_LIBRARIES)
endif(AKABEICORE_FIND_REQUIRED)
endif(AKABEICORE_FOUND)
endif(NOT AKABEICORE_INCLUDE_DIR)
# Search for the AkabeiCore library files.
FIND_LIBRARY(AKABEICORE_LIBRARIES
NAMES
akabeicore
PATHS
${AKABEICORE_LIB_DIR}
${LIB_INSTALL_DIR}
)
if(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
# Read from cache.
set(AKABEICORE_FOUND TRUE)
# Announce.
if(NOT AKABEICORE_FIND_QUIETLY)
message(STATUS "Looking for AkabeiCore library… FOUND.")
endif(NOT AKABEICORE_FIND_QUIETLY)
# Akabei could not be found.
else(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
message(STATUS "Looking for AkabeiCore library… NOT FOUND.")
function(MSG_AKABEI_INCLUDES SEVERITY)
message(${SEVERITY} " - Could not find AkabeiCore library header files.")
message(${SEVERITY} " Use AKABEICORE_INCLUDE_DIR to point to the directory where they are located.")
endfunction(MSG_AKABEI_INCLUDES)
function(MSG_AKABEI_LIBRARY SEVERITY)
message(${SEVERITY} " - Could not find AkabeiCore library files.")
message(${SEVERITY} " Use AKABEICORE_LIB_DIR to point to the directory where they are located.")
endfunction(MSG_AKABEI_LIBRARY)
if(AKABEICORE_FIND_REQUIRED)
if(NOT AKABEICORE_INCLUDE_DIR)
MSG_AKABEI_INCLUDES("FATAL_ERROR")
endif(NOT AKABEICORE_INCLUDE_DIR)
if(NOT AKABEICORE_LIBRARIES)
MSG_AKABEI_LIBRARY("FATAL_ERROR")
endif(NOT AKABEICORE_LIBRARIES)
else(AKABEICORE_FIND_REQUIRED)
if(NOT AKABEICORE_INCLUDE_DIR)
MSG_AKABEI_INCLUDES("STATUS")
endif(NOT AKABEICORE_INCLUDE_DIR)
if(NOT AKABEICORE_LIBRARIES)
MSG_AKABEI_LIBRARY("STATUS")
endif(NOT AKABEICORE_LIBRARIES)
endif(AKABEICORE_FIND_REQUIRED)
endif(AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES)
......@@ -15,7 +15,7 @@
#include <QUuid>
#include "apm.h"
#include <akabeierror.h>
#include <akabeiclient/akabeiclientdatabasehandler.h>
#include <akabeiclientdatabasehandler.h>
class SyncOperation : public QObject
{
......
......@@ -6,7 +6,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
find_package(KDE4 REQUIRED)
find_package(AkabeiCore REQUIRED)
if(NOT AKABEICORE_FOUND)
find_package(AkabeiCore REQUIRED)
endif(NOT AKABEICORE_FOUND)
include (KDE4Defaults)
set(akabei_clean_cache_SRCS main.cpp)
......
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