|
1 | | -project(casbin) |
2 | | - |
3 | 1 | cmake_minimum_required(VERSION 3.16) |
4 | 2 |
|
5 | | -set(CMAKE_CXX_STANDARD 11) |
6 | | -set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) |
| 3 | +set(CMAKE_WARN_DEPRECATED ON) |
| 4 | + |
| 5 | +if(APPLE AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) |
| 6 | + # The value of this variable should be set prior to the first project() command invocation |
| 7 | + # because it may influence configuration of the toolchain and flags. |
| 8 | + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version") |
| 9 | +endif() |
| 10 | + |
| 11 | +############################################################################### |
| 12 | +# Project definition. |
| 13 | + |
| 14 | +project(Casbin-CPP |
| 15 | + VERSION 1.0.0 |
| 16 | + DESCRIPTION "An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++" |
| 17 | + HOMEPAGE_URL https://github.com/casbin/casbin-cpp |
| 18 | + LANGUAGES CXX C) |
| 19 | + |
7 | 20 |
|
8 | | -FILE(GLOB_RECURSE SC_FILES "casbin/*.cpp" "casbin/*.h") |
| 21 | +############################################################################### |
| 22 | +# Forbid in-source build. |
| 23 | + |
| 24 | +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) |
| 25 | + message(FATAL_ERROR |
| 26 | + "In-source build not allowed. Please make a new sub-directory and run CMake from there.") |
| 27 | +endif() |
| 28 | + |
| 29 | +############################################################################### |
| 30 | +# Global CMake options. |
| 31 | + |
| 32 | +# Do not output install messages. |
| 33 | +if(NOT DEFINED CMAKE_INSTALL_MESSAGE) |
| 34 | + set(CMAKE_INSTALL_MESSAGE "NEVER") |
| 35 | +endif() |
| 36 | + |
| 37 | +# Change the path max size to avoid problem on Windows. |
| 38 | +if(NOT DEFINED CMAKE_OBJECT_PATH_MAX) |
| 39 | + set(CMAKE_OBJECT_PATH_MAX 300) |
| 40 | +endif() |
| 41 | + |
| 42 | +set(CMAKE_CXX_STANDARD 11) |
9 | 43 |
|
10 | | -add_library(casbin ${SC_FILES}) |
| 44 | +add_subdirectory(casbin) |
0 commit comments