Skip to content

Commit 542de11

Browse files
authored
Merge pull request #101 from EmperorYP7/initial-config
feat: Initiate CMake configuration
2 parents 6109ee4 + 475f23b commit 542de11

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

CMakeLists.txt

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,44 @@
1-
project(casbin)
2-
31
cmake_minimum_required(VERSION 3.16)
42

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+
720

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)
943

10-
add_library(casbin ${SC_FILES})
44+
add_subdirectory(casbin)

casbin/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
2+
3+
FILE(GLOB_RECURSE SC_FILES "*.cpp" "*.h")
4+
5+
add_library(casbin ${SC_FILES})

0 commit comments

Comments
 (0)