-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
75 additions
and
47 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
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,4 +1,6 @@ | ||
build/ | ||
.vs/ | ||
.vscode/ | ||
install/ | ||
build/ | ||
out/ | ||
Testing/ |
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,20 +1,75 @@ | ||
cmake_minimum_required (VERSION 3.6) | ||
project (vdf-Parser) | ||
cmake_minimum_required (VERSION 3.23) | ||
|
||
project( | ||
ValveFileVDF | ||
VERSION 1.0.0 | ||
DESCRIPTION "parses valve's vdf file format" | ||
HOMEPAGE_URL "https://github.com/TinyTinni/ValveFileVDF" | ||
LANGUAGES CXX C) | ||
|
||
option(VALVEFILEVDF_ENABLE_TESTING OFF) | ||
option(VALVEFILEVDF_ENABLE_FUZZING OFF) | ||
|
||
if (VALVEFILEVDF_ENABLE_FUZZING) | ||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" AND NOT APPLE) | ||
set(VALVEFILEVDF_ENABLE_FUZZING ON) | ||
else() | ||
set(VALVEFILEVDF_ENABLE_FUZZING OFF) | ||
message("Fuzzing not supported. Fuzzing gets disabled.") | ||
endif() | ||
endif() | ||
|
||
add_library(ValveFileVDF INTERFACE) | ||
add_library(ValveFileVDF::ValveFileVDF ALIAS ValveFileVDF) | ||
target_include_directories(ValveFileVDF INTERFACE "include") | ||
target_sources(ValveFileVDF | ||
PUBLIC FILE_SET HEADERS | ||
BASE_DIRS "include" | ||
FILES | ||
"include/vdf_parser.hpp" | ||
) | ||
|
||
include(CTest) | ||
add_subdirectory(./tests) | ||
############################# | ||
## Install | ||
|
||
set_target_properties(ValveFileVDF PROPERTIES PUBLIC_HEADER "include/vdf_parser.hpp") | ||
|
||
include(GNUInstallDirs) | ||
install(TARGETS ValveFileVDF | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
## add fuzzing, if supported | ||
include(CMakePackageConfigHelpers) | ||
|
||
set(ENABLE_FUZZING OFF) | ||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" AND NOT APPLE) | ||
set(ENABLE_FUZZING ON) | ||
|
||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
INSTALL_DESTINATION cmake | ||
) | ||
|
||
install(FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" | ||
DESTINATION cmake | ||
) | ||
|
||
|
||
################################### | ||
# Tests | ||
include(CTest) | ||
if (${VALVEFILEVDF_ENABLE_TESTING}) | ||
add_subdirectory(./tests) | ||
endif() | ||
|
||
if (${ENABLE_FUZZING}) | ||
|
||
if (${VALVEFILEVDF_ENABLE_FUZZING}) | ||
add_subdirectory(fuzzing) | ||
endif() |
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 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") | ||
|
||
check_required_components(@PROJECT_NAME@) |
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