target_compile_features no known features for CXX compiler "Clang" version 8.0.1. when use main project as a subdirectory
Hello i have the following CMake in my root project:
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the source code and call cmake from there")
endif ()
cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE on)
file(STRINGS "VERSION.md" VERSION_NB)
project(antara-gaming-sdk
VERSION ${VERSION_NB}
DESCRIPTION "Blockchain gaming sdk")
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message(FATAL_ERROR "Only Clang is supported (minimum LLVM 8.0)")
endif ()
option(USE_SFML_ANTARA_WRAPPER "Use SFML antara wrapper" OFF)
option(USE_LUA_ANTARA_WRAPPER "Use LUA antara wrapper" OFF)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(antara)
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/modules/core/antara/gaming/core/version.hpp)
configure_file(${CMAKE_MODULE_PATH}/version.hpp.in ${PROJECT_SOURCE_DIR}/modules/core/antara/gaming/core/version.hpp @ONLY)
endif ()
option(USE_ASAN "Use address sanitizer" OFF)
option(USE_TSAN "Use thread sanitizer" OFF)
option(USE_UBSAN "Use thread sanitizer" OFF)
option(ENABLE_COVERAGE "Enable coverage" OFF)
option(ANTARA_BUILD_EXAMPLES "Build project example" OFF)
option(ANTARA_BUILD_UNIT_TESTS "Enable the Build of unit tests" OFF)
if (LINUX)
option(BUILD_WITH_APPIMAGE "Build with appimage" OFF)
endif ()
if (EMSCRIPTEN)
option(ENABLE_HTML_COMPILATION "Enable web html compilation" OFF)
endif ()
option(COVERAGE_CLION_TOOLS "Enable Clion internal coverage tools" OFF)
add_subdirectory(modules)
if (ANTARA_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
As you can see my root project have some subdirectory with each one CMakeLists.txt.
Now i want to use my main project from another one:
with the following CMake:
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the source code and call cmake from there")
endif ()
cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 17)
project(my_game_project DESCRIPTION "my_game_description" LANGUAGES CXX)
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message(FATAL_ERROR "Only Clang is supported (minimum LLVM 8.0)")
endif ()
include(FetchContent)
set(USE_SFML_ANTARA_WRAPPER ON CACHE BOOL "Override option" FORCE)
FetchContent_Declare(
antara-gaming-sdk
URL https://github.com/KomodoPlatform/antara-gaming-sdk/archive/0.0.1.zip
)
FetchContent_MakeAvailable(antara-gaming-sdk)
add_subdirectory(${PROJECT_NAME})
But now, im getting the following error:
CMake Error at cmake-build-debug/_deps/antara-gaming-sdk-src/modules/config/CMakeLists.txt:7 (target_compile_features):
target_compile_features no known features for CXX compiler
"Clang"
version 8.0.1.
This is the CMakeLists.txt from the config directory:
## shared sources between the module and his unit tests
add_library(antara_config_shared_sources STATIC)
target_sources(antara_config_shared_sources PRIVATE
antara/gaming/config/config.game.cpp)
target_include_directories(antara_config_shared_sources PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(antara_config_shared_sources PUBLIC antara::default_settings nlohmann_json::nlohmann_json)
add_library(antara::config ALIAS antara_config_shared_sources)
if (ANTARA_BUILD_UNIT_TESTS)
##! antara config tests
add_executable(antara_config_tests)
target_sources(antara_config_tests PUBLIC
antara/gaming/config/antara.config.tests.cpp
antara/gaming/config/antara.config.game.tests.cpp)
target_link_libraries(antara_config_tests PRIVATE doctest PUBLIC antara::config)
set_target_properties(antara_config_tests
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/unit_tests"
)
target_enable_coverage(antara_config_tests)
target_enable_tsan(antara_config_tests)
target_enable_asan(antara_config_tests)
target_enable_ubsan(antara_config_tests)
if (EMSCRIPTEN)
message(STATUS "Emscripten detected")
if (ENABLE_HTML_COMPILATION)
message(STATUS "Html compilation enabled")
set_target_properties(antara_config_tests PROPERTIES LINK_FLAGS "-s FORCE_FILESYSTEM=1 -s EXIT_RUNTIME=1"
SUFFIX ".html")
else ()
message(STATUS "Local js compilation")
set_target_properties(antara_config_tests PROPERTIES LINK_FLAGS "-s FORCE_FILESYSTEM=1 -s NODERAWFS=1 -s EXIT_RUNTIME=1")
endif ()
endif ()
endif ()
I dont understand why i got this error