Skip to content

Commit

Permalink
cmake: use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
Browse files Browse the repository at this point in the history
This makes it possible to have a master CMakelists.txt file
while everything inside of core/ and webui/ still works also
stand alone.

Also fixed the registered trademark sign the header of the cmake files.
  • Loading branch information
pstorz committed Jan 15, 2019
1 parent 2fc5225 commit 1d8784c
Show file tree
Hide file tree
Showing 56 changed files with 185 additions and 164 deletions.
21 changes: 21 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,21 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2019-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
# License as published by the Free Software Foundation and included
# in the file LICENSE.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
cmake_minimum_required(VERSION 3.0)
add_subdirectory(core)
add_subdirectory(webui)
30 changes: 15 additions & 15 deletions core/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2018 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -65,8 +65,8 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
# run git-info to collect sourcecode info
file(MAKE_DIRECTORY build)
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/scripts/git-info.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/build
COMMAND ${PROJECT_SOURCE_DIR}/scripts/git-info.sh
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/build
)

INCLUDE(BareosExtractVersionInfo)
Expand Down Expand Up @@ -131,21 +131,21 @@ endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories(
${CMAKE_SOURCE_DIR}/src/win32/include
${CMAKE_SOURCE_DIR}/src/win32/compat/include
${PROJECT_SOURCE_DIR}/src/win32/include
${PROJECT_SOURCE_DIR}/src/win32/compat/include
)

set(HAVE_WIN32 1)

set(WINDOWS_LIBRARIES ws2_32)

SET(PYTHON_LIBRARIES ${CMAKE_SOURCE_DIR}/src/win32/plugins/python/lib/${WINDOWS_BITS}/python27.dll )
SET(PYTHON_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/win32/plugins/python/include)
SET(PYTHON_LIBRARIES ${PROJECT_SOURCE_DIR}/src/win32/plugins/python/lib/${WINDOWS_BITS}/python27.dll )
SET(PYTHON_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/win32/plugins/python/include)
SET(HAVE_PYTHON 1)

SET(PostgreSQL_LIBRARY ${CMAKE_SOURCE_DIR}/src/win32/cats/pgsql/lib/${WINDOWS_BITS}/libpq.dll)
SET(PostgreSQL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/win32/cats/pgsql/include)
SET(PostgreSQL_TYPE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/win32/plugins/python/include)
SET(PostgreSQL_LIBRARY ${PROJECT_SOURCE_DIR}/src/win32/cats/pgsql/lib/${WINDOWS_BITS}/libpq.dll)
SET(PostgreSQL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/win32/cats/pgsql/include)
SET(PostgreSQL_TYPE_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/win32/plugins/python/include)


else()
Expand Down Expand Up @@ -248,7 +248,7 @@ ENDIF()

MESSAGE( STATUS "VERSION: " ${CMAKE_MATCH_1} )

MESSAGE( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )


# needed for check_include
Expand All @@ -267,7 +267,7 @@ include_directories(${PYTHON_INCLUDE_DIRS})

include_directories(${PYTHON_INCLUDE_PATH})

include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src)

# trick for socklen_t
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
Expand All @@ -285,7 +285,7 @@ set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
# /* C++ comment style not allowed */


# if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise
# if you are building in-source, this is the same as PROJECT_SOURCE_DIR, otherwise
# this is the top level directory of your build tree
MESSAGE( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )

Expand All @@ -294,7 +294,7 @@ MESSAGE( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )
MESSAGE( STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR} )

# this is the directory, from which cmake was started, i.e. the top level source directory
MESSAGE( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )

# this is the directory where the currently processed CMakeLists.txt is located in
MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosCheckFunctions.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosCheckIncludes.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosCheckStructHasMembers.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosCheckSymbols.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosConfigureFile.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosDetermineHaveLowLevelScsiInterface.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
10 changes: 5 additions & 5 deletions core/cmake/BareosExtractVersionInfo.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -19,17 +19,17 @@


# extract version number from version.h
file(STRINGS ${CMAKE_SOURCE_DIR}/src/include/version.h VERSION_INFO REGEX define.*VERSION.*)
file(STRINGS ${PROJECT_SOURCE_DIR}/src/include/version.h VERSION_INFO REGEX define.*VERSION.*)
string(REGEX MATCH [0-9.]+ VERSION ${VERSION_INFO})
string(REGEX MATCH [0-9]+ SOVERSION ${VERSION_INFO})
string(REGEX MATCH \".*\" FULLVERSION ${VERSION_INFO})

# extract date from version.h
file(STRINGS ${CMAKE_SOURCE_DIR}/src/include/version.h DATE_INFO REGEX define.*BDATE.*)
file(STRINGS ${PROJECT_SOURCE_DIR}/src/include/version.h DATE_INFO REGEX define.*BDATE.*)
string(REGEX MATCH \".*\" DATE ${DATE_INFO})
string(REGEX REPLACE "\"" "" DATE ${DATE})


# extract db version from cats.h
file(STRINGS ${CMAKE_SOURCE_DIR}/src/cats/cats.h DB_VERSION_INFO REGEX .*BDB_VERSION.*)
file(STRINGS ${PROJECT_SOURCE_DIR}/src/cats/cats.h DB_VERSION_INFO REGEX .*BDB_VERSION.*)
string(REGEX MATCH [0-9]+ BDB_VERSION ${DB_VERSION_INFO})
4 changes: 2 additions & 2 deletions core/cmake/BareosFindAllLibraries.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2018 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosFindLibrary.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosFindLibraryAndHeaders.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosFindPrograms.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosGenerateDebianInfo.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2018-2018 Bareos GmbH & Co. KG
# Copyright (C) 2018-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosGetDistInfo.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosInstallConfigFiles.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2018 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosSetVariableDefaults.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/BareosTypeSizes.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/CodeCoverage.cmake
Expand Up @@ -72,7 +72,7 @@ include(CMakeParseArguments)
find_program( GCOV_PATH gcov )
find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl)
find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat )
find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
find_program( GCOVR_PATH gcovr PATHS ${PROJECT_SOURCE_DIR}/scripts/test)
find_program( SIMPLE_PYTHON_EXECUTABLE python )

if(NOT GCOV_PATH)
Expand Down Expand Up @@ -216,7 +216,7 @@ function(SETUP_TARGET_FOR_COVERAGE_COBERTURA)
${Coverage_EXECUTABLE}

# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} ${COBERTURA_EXCLUDES}
COMMAND ${GCOVR_PATH} -x -r ${PROJECT_SOURCE_DIR} ${COBERTURA_EXCLUDES}
-o ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/bareos-symlink-default-db-backend.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/install-dird-configfiles.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/install-filed-configfiles.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/install-stored-configfiles.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/cmake/install-tray-monitor-configfiles.cmake
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/manpages/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/platforms/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/platforms/debian/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/platforms/freebsd/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2018-2018 Bareos GmbH & Co. KG
# Copyright (C) 2018-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/platforms/redhat/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/platforms/solaris/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/platforms/suse/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOS�� - Backup Archiving REcovery Open Sourced
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2017 Bareos GmbH & Co. KG
# Copyright (C) 2017-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down

0 comments on commit 1d8784c

Please sign in to comment.