mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-07-08 07:01:46 +08:00
54 lines
1.5 KiB
CMake
54 lines
1.5 KiB
CMake
project(tinygltf-validator CXX)
|
|
|
|
cmake_minimum_required(VERSION 3.2)
|
|
|
|
# Use C++11
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
# exe
|
|
add_executable(tinygltf-validator
|
|
tinygltf-validate.cc
|
|
json11.cpp)
|
|
|
|
target_include_directories(tinygltf-validator
|
|
PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/valijson/include
|
|
${CMAKE_CURRENT_SOURCE_DIR}/
|
|
)
|
|
|
|
# Enable more compiler warnings, except when using Visual Studio compiler
|
|
if(NOT MSVC)
|
|
target_compile_options(tinygltf-validator
|
|
PUBLIC
|
|
-Wall -Wextra)
|
|
endif()
|
|
target_compile_definitions(tinygltf-validator
|
|
PRIVATE
|
|
-DJSON_SCHEMA_VALIDATOR_EXPORTS)
|
|
|
|
# regex with boost if gcc < 4.8 - default is std::regex
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")
|
|
find_package(Boost COMPONENTS regex)
|
|
if(NOT Boost_FOUND)
|
|
message(STATUS "GCC less then 4.9 and boost-regex NOT found - no regex used")
|
|
target_compile_definitions(tinygltf-validator PRIVATE -DJSON_SCHEMA_NO_REGEX)
|
|
else()
|
|
message(STATUS "GCC less then 4.9 and boost-regex FOUND - using boost::regex")
|
|
target_compile_definitions(tinygltf-validator PRIVATE -DJSON_SCHEMA_BOOST_REGEX)
|
|
target_include_directories(tinygltf-validator PRIVATE ${Boost_INCLUDE_DIRS})
|
|
target_link_libraries(tinygltf-validator PRIVATE ${Boost_LIBRARIES})
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
# test-zone
|
|
# enable_testing()
|
|
|
|
install ( TARGETS
|
|
tinygltf-validator
|
|
DESTINATION
|
|
bin
|
|
)
|
|
|