-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from EmperorYP7/initial-config
feat: Initiate CMake configuration
- Loading branch information
Showing
2 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,44 @@ | ||
project(casbin) | ||
|
||
cmake_minimum_required(VERSION 3.16) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) | ||
set(CMAKE_WARN_DEPRECATED ON) | ||
|
||
if(APPLE AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) | ||
# The value of this variable should be set prior to the first project() command invocation | ||
# because it may influence configuration of the toolchain and flags. | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version") | ||
endif() | ||
|
||
############################################################################### | ||
# Project definition. | ||
|
||
project(Casbin-CPP | ||
VERSION 1.0.0 | ||
DESCRIPTION "An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++" | ||
HOMEPAGE_URL https://github.com/casbin/casbin-cpp | ||
LANGUAGES CXX C) | ||
|
||
|
||
FILE(GLOB_RECURSE SC_FILES "casbin/*.cpp" "casbin/*.h") | ||
############################################################################### | ||
# Forbid in-source build. | ||
|
||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) | ||
message(FATAL_ERROR | ||
"In-source build not allowed. Please make a new sub-directory and run CMake from there.") | ||
endif() | ||
|
||
############################################################################### | ||
# Global CMake options. | ||
|
||
# Do not output install messages. | ||
if(NOT DEFINED CMAKE_INSTALL_MESSAGE) | ||
set(CMAKE_INSTALL_MESSAGE "NEVER") | ||
endif() | ||
|
||
# Change the path max size to avoid problem on Windows. | ||
if(NOT DEFINED CMAKE_OBJECT_PATH_MAX) | ||
set(CMAKE_OBJECT_PATH_MAX 300) | ||
endif() | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
add_library(casbin ${SC_FILES}) | ||
add_subdirectory(casbin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) | ||
|
||
FILE(GLOB_RECURSE SC_FILES "*.cpp" "*.h") | ||
|
||
add_library(casbin ${SC_FILES}) |