Skip to main content
Add KDE FindACL.cmake file
Source Link
janw
  • 9.9k
  • 13
  • 52
  • 71

I am currently trying to set up a CMake-based build system for a small C library of mine. Since this library depends on libacl, CMake should verify that it is present on the system, or fail otherwise.

Since there is no predefined FindACL module, I used the one from the KDE project.:

[...] check_include_files [...] find_library [...]

if (ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS)
   set(ACL_FOUND TRUE)
   set(ACL_LIBS ${ACL_LIBS} ${ATTR_LIBS})
   message(STATUS "Found ACL support: ${ACL_LIBS}")
endif (ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS)

I call it using the following (minimal) CMakeLists.txt:

cmake_minimum_required(VERSION 3.12)

project(
    cmaketest
    VERSION 1.0
    DESCRIPTION "cmake test"
    LANGUAGES C
)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ACL REQUIRED) # ACL_LIBS

It correctly detects that my system is lacking the libacl includes, but does not stop processing, even though the manual states that

The REQUIRED option stops processing with an error message if the package cannot be found.

Do I have to explicitly check whether ACL_FOUND is set, through an if statement?

I am using CMake 3.13.4. Terminal output:

-- The C compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file attr/libattr.h
-- Looking for include file attr/libattr.h - not found
-- Looking for include file sys/xattr.h
-- Looking for include file sys/xattr.h - found
-- Looking for include file sys/acl.h
-- Looking for include file sys/acl.h - not found
-- Looking for include file acl/libacl.h
-- Looking for include file acl/libacl.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: [redacted]/build

I am currently trying to set up a CMake-based build system for a small C library of mine. Since this library depends on libacl, CMake should verify that it is present on the system, or fail otherwise.

Since there is no predefined FindACL module, I used the one from the KDE project. I call it using the following (minimal) CMakeLists.txt:

cmake_minimum_required(VERSION 3.12)

project(
    cmaketest
    VERSION 1.0
    DESCRIPTION "cmake test"
    LANGUAGES C
)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ACL REQUIRED) # ACL_LIBS

It correctly detects that my system is lacking the libacl includes, but does not stop processing, even though the manual states that

The REQUIRED option stops processing with an error message if the package cannot be found.

Do I have to explicitly check whether ACL_FOUND is set, through an if statement?

I am using CMake 3.13.4. Terminal output:

-- The C compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file attr/libattr.h
-- Looking for include file attr/libattr.h - not found
-- Looking for include file sys/xattr.h
-- Looking for include file sys/xattr.h - found
-- Looking for include file sys/acl.h
-- Looking for include file sys/acl.h - not found
-- Looking for include file acl/libacl.h
-- Looking for include file acl/libacl.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: [redacted]/build

I am currently trying to set up a CMake-based build system for a small C library of mine. Since this library depends on libacl, CMake should verify that it is present on the system, or fail otherwise.

Since there is no predefined FindACL module, I used the one from the KDE project:

[...] check_include_files [...] find_library [...]

if (ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS)
   set(ACL_FOUND TRUE)
   set(ACL_LIBS ${ACL_LIBS} ${ATTR_LIBS})
   message(STATUS "Found ACL support: ${ACL_LIBS}")
endif (ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS)

I call it using the following (minimal) CMakeLists.txt:

cmake_minimum_required(VERSION 3.12)

project(
    cmaketest
    VERSION 1.0
    DESCRIPTION "cmake test"
    LANGUAGES C
)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ACL REQUIRED) # ACL_LIBS

It correctly detects that my system is lacking the libacl includes, but does not stop processing, even though the manual states that

The REQUIRED option stops processing with an error message if the package cannot be found.

Do I have to explicitly check whether ACL_FOUND is set, through an if statement?

I am using CMake 3.13.4. Terminal output:

-- The C compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file attr/libattr.h
-- Looking for include file attr/libattr.h - not found
-- Looking for include file sys/xattr.h
-- Looking for include file sys/xattr.h - found
-- Looking for include file sys/acl.h
-- Looking for include file sys/acl.h - not found
-- Looking for include file acl/libacl.h
-- Looking for include file acl/libacl.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: [redacted]/build
Problem is still present after updating CMake
Source Link
janw
  • 9.9k
  • 13
  • 52
  • 71

I am currently trying to set up a CMake-based build system for a small C library of mine. Since this library depends on libacl, CMake should verify that it is present on the system, or fail otherwise.

Since there is no predefined FindACL module, I used the one from the KDE project. I call it using the following (minimal) CMakeLists.txt:

cmake_minimum_required(VERSION 3.1012)

project(
    cmaketest
    VERSION 1.0
    DESCRIPTION "cmake test"
    LANGUAGES C
)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ACL REQUIRED) # ACL_LIBS

It correctly detects that my system is lacking the libacl includes, but does not stop processing, even though the manual states that

The REQUIRED option stops processing with an error message if the package cannot be found.

Do I have to explicitly check whether ACL_FOUND is set, through an if statement?

I am using CMake 3.1013.24. Terminal output:

-- The C compiler identification is GNU 78.43.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file attr/libattr.h
-- Looking for include file attr/libattr.h - not found
-- Looking for include file sys/xattr.h
-- Looking for include file sys/xattr.h - found
-- Looking for include file sys/acl.h
-- Looking for include file sys/acl.h - not found
-- Looking for include file acl/libacl.h
-- Looking for include file acl/libacl.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: [redacted]/build

I am currently trying to set up a CMake-based build system for a small C library of mine. Since this library depends on libacl, CMake should verify that it is present on the system, or fail otherwise.

Since there is no predefined FindACL module, I used the one from the KDE project. I call it using the following (minimal) CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)

project(
    cmaketest
    VERSION 1.0
    DESCRIPTION "cmake test"
    LANGUAGES C
)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ACL REQUIRED) # ACL_LIBS

It correctly detects that my system is lacking the libacl includes, but does not stop processing, even though the manual states that

The REQUIRED option stops processing with an error message if the package cannot be found.

Do I have to explicitly check whether ACL_FOUND is set, through an if statement?

I am using CMake 3.10.2. Terminal output:

-- The C compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file attr/libattr.h
-- Looking for include file attr/libattr.h - not found
-- Looking for include file sys/xattr.h
-- Looking for include file sys/xattr.h - found
-- Looking for include file sys/acl.h
-- Looking for include file sys/acl.h - not found
-- Looking for include file acl/libacl.h
-- Looking for include file acl/libacl.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: [redacted]/build

I am currently trying to set up a CMake-based build system for a small C library of mine. Since this library depends on libacl, CMake should verify that it is present on the system, or fail otherwise.

Since there is no predefined FindACL module, I used the one from the KDE project. I call it using the following (minimal) CMakeLists.txt:

cmake_minimum_required(VERSION 3.12)

project(
    cmaketest
    VERSION 1.0
    DESCRIPTION "cmake test"
    LANGUAGES C
)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ACL REQUIRED) # ACL_LIBS

It correctly detects that my system is lacking the libacl includes, but does not stop processing, even though the manual states that

The REQUIRED option stops processing with an error message if the package cannot be found.

Do I have to explicitly check whether ACL_FOUND is set, through an if statement?

I am using CMake 3.13.4. Terminal output:

-- The C compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file attr/libattr.h
-- Looking for include file attr/libattr.h - not found
-- Looking for include file sys/xattr.h
-- Looking for include file sys/xattr.h - found
-- Looking for include file sys/acl.h
-- Looking for include file sys/acl.h - not found
-- Looking for include file acl/libacl.h
-- Looking for include file acl/libacl.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: [redacted]/build
Source Link
janw
  • 9.9k
  • 13
  • 52
  • 71

find_package(ACL REQUIRED) does not stop processing

I am currently trying to set up a CMake-based build system for a small C library of mine. Since this library depends on libacl, CMake should verify that it is present on the system, or fail otherwise.

Since there is no predefined FindACL module, I used the one from the KDE project. I call it using the following (minimal) CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)

project(
    cmaketest
    VERSION 1.0
    DESCRIPTION "cmake test"
    LANGUAGES C
)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ACL REQUIRED) # ACL_LIBS

It correctly detects that my system is lacking the libacl includes, but does not stop processing, even though the manual states that

The REQUIRED option stops processing with an error message if the package cannot be found.

Do I have to explicitly check whether ACL_FOUND is set, through an if statement?

I am using CMake 3.10.2. Terminal output:

-- The C compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file attr/libattr.h
-- Looking for include file attr/libattr.h - not found
-- Looking for include file sys/xattr.h
-- Looking for include file sys/xattr.h - found
-- Looking for include file sys/acl.h
-- Looking for include file sys/acl.h - not found
-- Looking for include file acl/libacl.h
-- Looking for include file acl/libacl.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: [redacted]/build