[SCM] UID Wrapper Repository - branch master updated
Andreas Schneider
asn at samba.org
Mon Jun 3 13:21:11 UTC 2019
The branch, master has been updated
via 0ae7595 gitlab-ci: Setup CI for uid_wrapper
via 12fe095 cmake: Use GNUInstallDirs
via bc50185 tests: Don't run test_uwrap_disabled with sanitizers
via 89ff574 cmake: Correctly set _GNU_SOURCE
via f8bc8c2 cmake: Fix configure check for libdl
via 4ed04f4 cmake: Use target_include_directories()
via a25fbab cmake: Update AddCMockaTest.cmake
via e372761 cmake: Update cmocka requirement
via 896a138 cmake: Support running the tests with AddressSanitizer
via de52edb cmake: Add AddressSanitizer and UndefinedSanitizer
via 19a5414 cmake: Move Compiler flags to new file
via 40955ff cmake: Remove obsolete DefineCompilerFlags.cmake
via 14c4982 cmake: Improve checks for compiler flags
via 11e2e2d cmake: Update CMake defaults
via b1c6704 cmake: Do not misuse CMAKE_REQUIRED_LIBRARIES
via 37a8e23 cmake: Require at least cmake 3.5.0
via b657bce cpack: Fix description and vendor
via 67280b7 README: Rename to a markdown file
via f8c7170 uwrap: Remove problematic FALL_THROUGH in uwrap_load_lib_handle()
via 2273c8e uwrap: Don't do a deep bind if we run with libasan
from 77f7ce8 ctest: Move to new dashboard
https://git.samba.org/?p=uid_wrapper.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0ae7595d48913c552ddd259a990612adfb4413fd
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 13:03:37 2019 +0200
gitlab-ci: Setup CI for uid_wrapper
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 12fe095e01c6e2ee18ba864677d409c0d4afd529
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 13:02:04 2019 +0200
cmake: Use GNUInstallDirs
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit bc501857f00d6f0d5f3fc150dd73adca7dfed83c
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:58:49 2019 +0200
tests: Don't run test_uwrap_disabled with sanitizers
or on cross compiled hosts (Debian MIPS).
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 89ff574c381b6e4cc462d58e3fad9e434e362bfe
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:57:32 2019 +0200
cmake: Correctly set _GNU_SOURCE
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit f8bc8c21ce91eaf6da92abfbda3ce5621cf2075d
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:46:47 2019 +0200
cmake: Fix configure check for libdl
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 4ed04f4d6a5093edabb9b2d97de42b1d7505a0f1
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:45:48 2019 +0200
cmake: Use target_include_directories()
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit a25fbab6607e792d491f884f28b18dbcce5970a0
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:39:55 2019 +0200
cmake: Update AddCMockaTest.cmake
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit e3727612fe1487cebf10d0f65666efba308a6adc
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:33:15 2019 +0200
cmake: Update cmocka requirement
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 896a138b23ed3835967a00abfa1799131f01231a
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:32:29 2019 +0200
cmake: Support running the tests with AddressSanitizer
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit de52edbf5cd9d2a0fd3153ce1e05e0b5168086d6
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:16:11 2019 +0200
cmake: Add AddressSanitizer and UndefinedSanitizer
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 19a5414aadccae4a35cead4f9579e2c03d18cc1c
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:15:16 2019 +0200
cmake: Move Compiler flags to new file
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 40955ffad292d9d175c9a49d9b44d8bb19072b79
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:12:30 2019 +0200
cmake: Remove obsolete DefineCompilerFlags.cmake
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 14c4982ec5b211c6ae9294405810972aed3e2920
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:11:45 2019 +0200
cmake: Improve checks for compiler flags
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 11e2e2d38a3390753d2031776d2bee6325e690ea
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:06:25 2019 +0200
cmake: Update CMake defaults
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit b1c6704c5c3c46fe5a99a79a9caa8b4213046490
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:05:16 2019 +0200
cmake: Do not misuse CMAKE_REQUIRED_LIBRARIES
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 37a8e2353d84eea9f4145b8fc1797185d010e378
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:03:12 2019 +0200
cmake: Require at least cmake 3.5.0
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit b657bceb369da00997a623aa8fb182ef5f217908
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 12:00:30 2019 +0200
cpack: Fix description and vendor
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 67280b7b30df84f17fdafd61593789fbb748906f
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 11:55:49 2019 +0200
README: Rename to a markdown file
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit f8c71703cac116fc4d2f5ef6620cf47c2cf0d0db
Author: Andreas Schneider <asn at samba.org>
Date: Tue May 7 13:07:01 2019 +0200
uwrap: Remove problematic FALL_THROUGH in uwrap_load_lib_handle()
src/uid_wrapper.c:93:24: error: a label can only be part of a statement
and a declaration is not a statement
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
commit 2273c8e24a6577285d905213519540b8173ad228
Author: Andreas Schneider <asn at samba.org>
Date: Sat Sep 1 19:43:20 2018 +0200
uwrap: Don't do a deep bind if we run with libasan
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Gary Lockyer <gary at samba.org>
-----------------------------------------------------------------------
Summary of changes:
.gitlab-ci.yml | 234 ++++++++++++++++++++++++++++
CMakeLists.txt | 38 +++--
CPackConfig.cmake | 15 +-
CompilerChecks.cmake | 114 ++++++++++++++
ConfigureChecks.cmake | 23 +--
README => README.md | 4 +-
cmake/Modules/AddCCompilerFlag.cmake | 21 +++
cmake/Modules/AddCMockaTest.cmake | 125 +++++++++++++--
cmake/Modules/CheckCCompilerFlagSSP.cmake | 36 ++++-
cmake/Modules/DefineCMakeDefaults.cmake | 15 +-
cmake/Modules/DefineCompilerFlags.cmake | 113 +++++---------
cmake/Modules/DefineInstallationPaths.cmake | 109 -------------
cmake/Modules/FindCMocka.cmake | 49 ------
cmake/Toolchain-Debian-mips.cmake | 21 +++
config.h.cmake | 4 +-
src/CMakeLists.txt | 20 ++-
src/uid_wrapper.c | 22 ++-
tests/CMakeLists.txt | 186 ++++++++++++++--------
uid_wrapper-config-version.cmake.in | 2 +-
uid_wrapper-config.cmake.in | 2 +-
uid_wrapper.pc.cmake | 6 +-
21 files changed, 769 insertions(+), 390 deletions(-)
create mode 100644 .gitlab-ci.yml
create mode 100644 CompilerChecks.cmake
rename README => README.md (86%)
create mode 100644 cmake/Modules/AddCCompilerFlag.cmake
delete mode 100644 cmake/Modules/DefineInstallationPaths.cmake
delete mode 100644 cmake/Modules/FindCMocka.cmake
create mode 100644 cmake/Toolchain-Debian-mips.cmake
Changeset truncated at 500 lines:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..f516947
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,234 @@
+variables:
+ GIT_DEPTH: 3
+ BUILD_IMAGES_PROJECT: cmocka/gitlab-build-images
+ FEDORA_BUILD: buildenv-fedora
+ CENTOS7_BUILD: buildenv-centos7
+ TUMBLEWEED_BUILD: buildenv-tumbleweed
+ MINGW_BUILD: buildenv-mingw
+ DEBIAN_CROSS_BUILD: buildenv-debian-cross
+
+centos7/x86_64:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake3
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+fedora/x86_64:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+fedora/address-sanitizer:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_BUILD_TYPE=AddressSanitizer
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+fedora/undefined-sanitizer:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_BUILD_TYPE=UndefinedSanitizer
+ -DUNIT_TESTING=ON ..
+ && make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+fedora/csbuild:
+ variables:
+ GIT_DEPTH: 20
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
+ script:
+ - |
+ if [[ -z "$CI_COMMIT_BEFORE_SHA" ]]; then
+ export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~15")
+ fi
+
+ # Check if the commit exists in this branch
+ # This is not the case for a force push
+ git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~15")
+
+ export CI_COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
+
+ - csbuild
+ --build-dir=obj-csbuild
+ --prep-cmd="cmake -DCMAKE_BUILD_TYPE=Debug -DPICKY_DEVELOPER=ON -DUNIT_TESTING=ON @SRCDIR@"
+ --build-cmd "make clean && make -j$(nproc)"
+ --git-commit-range $CI_COMMIT_RANGE
+ --color
+ --print-current --print-fixed
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj-csbuild/
+
+freebsd/x86_64:
+ image:
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ make && ctest --output-on-failure
+ tags:
+ - freebsd
+ except:
+ - tags
+ only:
+ - branches at cwrap/uid_wrapper
+ - branches at cryptomilk/uid_wrapper
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+.Debian.cross.template: &Debian_cross_template
+ stage: test
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_CROSS_BUILD
+ script:
+ - build=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ - host="${CI_JOB_NAME#*.cross.}"
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-Debian-mips.cmake
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DUNIT_TESTING=ON .. && make -j$(nproc) &&
+ ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+Debian.cross.mips-linux-gnu:
+ <<: *Debian_cross_template
+
+tumbleweed/x86_64/gcc:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+tumbleweed/x86_64/gcc7:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+tumbleweed/x86_64/clang:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+tumbleweed/static-analysis:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
+ script:
+ - export CCC_CC=clang
+ - export CCC_CXX=clang++
+ - mkdir -p obj && cd obj && scan-build cmake
+ -DCMAKE_BUILD_TYPE=Debug
+ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON .. &&
+ scan-build --status-bugs -o scan make -j$(nproc)
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/scan
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9dba9d5..cdebea6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,16 +1,20 @@
-project(uid_wrapper C)
-
# Required cmake version
-cmake_minimum_required(VERSION 2.8.0)
+cmake_minimum_required(VERSION 3.5.0)
+cmake_policy(SET CMP0048 NEW)
-# global needed variables
-set(APPLICATION_NAME ${PROJECT_NAME})
+# Specify search path for CMake modules to be loaded by include()
+# and find_package()
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
+
+# Add defaults for cmake
+# Those need to be set before the project() call.
+include(DefineCMakeDefaults)
+include(DefineCompilerFlags)
-set(APPLICATION_VERSION_MAJOR "1")
-set(APPLICATION_VERSION_MINOR "2")
-set(APPLICATION_VERSION_PATCH "4")
+project(uid_wrapper VERSION 1.1.5 LANGUAGES C)
-set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
+# global needed variables
+set(APPLICATION_NAME ${PROJECT_NAME})
# SOVERSION scheme: CURRENT.AGE.REVISION
# If there was an incompatible interface change:
@@ -22,18 +26,12 @@ set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
set(LIBRARY_VERSION "0.0.6")
set(LIBRARY_SOVERSION "0")
-# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
-set(CMAKE_MODULE_PATH
- ${CMAKE_SOURCE_DIR}/cmake/Modules
-)
-
# add definitions
-include(DefineCMakeDefaults)
include(DefinePlatformDefaults)
-include(DefineCompilerFlags)
-include(DefineInstallationPaths)
include(DefineOptions.cmake)
include(CPackConfig.cmake)
+include(CompilerChecks.cmake)
+include(GNUInstallDirs)
# disallow in-source build
include(MacroEnsureOutOfSourceBuild)
@@ -51,7 +49,7 @@ configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_subdirectory(src)
if (UNIT_TESTING)
- find_package(CMocka REQUIRED)
+ find_package(cmocka 1.1.0 REQUIRED)
include(AddCMockaTest)
add_subdirectory(tests)
endif (UNIT_TESTING)
@@ -64,7 +62,7 @@ install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/uid_wrapper.pc
DESTINATION
- ${LIB_INSTALL_DIR}/pkgconfig
+ ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT
pkgconfig
)
@@ -77,7 +75,7 @@ install(
${CMAKE_CURRENT_BINARY_DIR}/uid_wrapper-config-version.cmake
${CMAKE_CURRENT_BINARY_DIR}/uid_wrapper-config.cmake
DESTINATION
- ${CMAKE_INSTALL_DIR}/uid_wrapper
+ ${CMAKE_INSTALL_LIBDIR}/uid_wrapper
COMPONENT
devel
)
diff --git a/CPackConfig.cmake b/CPackConfig.cmake
index e1b83ac..955c8ee 100644
--- a/CPackConfig.cmake
+++ b/CPackConfig.cmake
@@ -2,19 +2,16 @@
# http://www.cmake.org/Wiki/CMake:CPackConfiguration
### general settings
-set(CPACK_PACKAGE_NAME ${APPLICATION_NAME})
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The SSH library")
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
-set(CPACK_PACKAGE_VENDOR "The SSH Library Development Team")
+set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The UID wrapper library")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
+set(CPACK_PACKAGE_VENDOR "The Samba Team")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
### versions
-set(CPACK_PACKAGE_VERSION_MAJOR "${APPLICATION_VERSION_MAJOR}")
-set(CPACK_PACKAGE_VERSION_MINOR "${APPLICATION_VERSION_MINOR}")
-set(CPACK_PACKAGE_VERSION_PATCH "${APPLICATION_VERSION_PATCH}")
-set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
### source generator
@@ -37,7 +34,7 @@ endif (WIN32)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "libssh")
-set(CPACK_PACKAGE_FILE_NAME ${APPLICATION_NAME}-${CPACK_PACKAGE_VERSION})
+set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers")
diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake
new file mode 100644
index 0000000..4fa1a83
--- /dev/null
+++ b/CompilerChecks.cmake
@@ -0,0 +1,114 @@
+include(AddCCompilerFlag)
+include(CheckCCompilerFlagSSP)
+
+if (UNIX)
+ #
+ # Check for -Werror turned on if possible
+ #
+ # This will prevent that compiler flags are detected incorrectly.
+ #
+ check_c_compiler_flag("-Werror" REQUIRED_FLAGS_WERROR)
+ if (REQUIRED_FLAGS_WERROR)
+ set(CMAKE_REQUIRED_FLAGS "-Werror")
+
+ if (PICKY_DEVELOPER)
+ list(APPEND SUPPORTED_COMPILER_FLAGS "-Werror")
+ endif()
+ endif()
+
+ add_c_compiler_flag("-std=gnu99" SUPPORTED_COMPILER_FLAGS)
+ #add_c_compiler_flag("-Wpedantic" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wall" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wshadow" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wmissing-prototypes" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wcast-align" SUPPORTED_COMPILER_FLAGS)
+ #add_c_compiler_flag("-Wcast-qual" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=address" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wstrict-prototypes" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=strict-prototypes" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wwrite-strings" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=write-strings" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror-implicit-function-declaration" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wpointer-arith" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=pointer-arith" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wdeclaration-after-statement" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=declaration-after-statement" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wreturn-type" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=return-type" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wuninitialized" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=uninitialized" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wimplicit-fallthrough" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=strict-overflow" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wstrict-overflow=2" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wno-format-zero-length" SUPPORTED_COMPILER_FLAGS)
+
+ check_c_compiler_flag("-Wformat" REQUIRED_FLAGS_WFORMAT)
+ if (REQUIRED_FLAGS_WFORMAT)
+ list(APPEND SUPPORTED_COMPILER_FLAGS "-Wformat")
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wformat")
+ endif()
+ add_c_compiler_flag("-Wformat-security" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Werror=format-security" SUPPORTED_COMPILER_FLAGS)
+
+ # Allow zero for a variadic macro argument
+ string(TOLOWER "${CMAKE_C_COMPILER_ID}" _C_COMPILER_ID)
+ if ("${_C_COMPILER_ID}" STREQUAL "clang")
+ add_c_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" SUPPORTED_COMPILER_FLAGS)
+ endif()
+
+ add_c_compiler_flag("-fno-common" SUPPORTED_COMPILER_FLAGS)
+
+ if (CMAKE_BUILD_TYPE)
+ string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
+ if (CMAKE_BUILD_TYPE_LOWER MATCHES (release|relwithdebinfo|minsizerel))
+ add_c_compiler_flag("-Wp,-D_FORTIFY_SOURCE=2" SUPPORTED_COMPILER_FLAGS)
+ endif()
+ endif()
+
+ if (NOT SOLARIS)
+ check_c_compiler_flag_ssp("-fstack-protector-strong" WITH_STACK_PROTECTOR_STRONG)
+ if (WITH_STACK_PROTECTOR_STRONG)
+ list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector-strong")
+ # This is needed as Solaris has a seperate libssp
+ if (SOLARIS)
+ list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector-strong")
+ endif()
+ else (WITH_STACK_PROTECTOR_STRONG)
+ check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
+ if (WITH_STACK_PROTECTOR)
+ list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector")
+ # This is needed as Solaris has a seperate libssp
+ if (SOLARIS)
+ list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector")
+ endif()
+ endif()
+ endif (WITH_STACK_PROTECTOR_STRONG)
+
+ check_c_compiler_flag_ssp("-fstack-clash-protection" WITH_STACK_CLASH_PROTECTION)
+ if (WITH_STACK_CLASH_PROTECTION)
+ list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-clash-protection")
+ endif()
+ endif()
+
+ if (PICKY_DEVELOPER)
+ add_c_compiler_flag("-Wno-error=deprecated-declarations" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wno-error=tautological-compare" SUPPORTED_COMPILER_FLAGS)
+ endif()
+
+ # Unset CMAKE_REQUIRED_FLAGS
+ unset(CMAKE_REQUIRED_FLAGS)
+endif()
+
+if (MSVC)
+ add_c_compiler_flag("/D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("/D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("/D _CRT_NONSTDC_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("/D _CRT_SECURE_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
+endif()
+
+if (SUPPORTED_COMPILER_FLAGS)
+ set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE)
+endif()
+if (SUPPORTED_LINKER_FLAGS)
+ set(DEFAULT_LINK_FLAGS ${SUPPORTED_LINKER_FLAGS} CACHE INTERNAL "Default C Linker Flags" FORCE)
+endif()
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 910a255..affe7c6 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -7,8 +7,8 @@ include(CheckStructHasMember)
include(CheckPrototypeDefinition)
include(TestBigEndian)
-set(PACKAGE ${APPLICATION_NAME})
-set(VERSION ${APPLICATION_VERSION})
+set(PACKAGE ${PROJECT_NAME})
+set(VERSION ${PROJECT_VERSION})
set(DATADIR ${DATA_INSTALL_DIR})
set(LIBDIR ${LIB_INSTALL_DIR})
set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}")
@@ -82,13 +82,14 @@ endif (HAVE_SETGROUPS)
check_function_exists(syscall HAVE_SYSCALL)
if (HAVE_SYSCALL)
- add_definitions(-D_GNU_SOURCE)
--
UID Wrapper Repository
More information about the samba-cvs
mailing list