mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-14 02:35:37 +00:00
(#13984) [templates] Keep same pattern for cmake and min_cppstd
Signed-off-by: Uilian Ries <uilianries@gmail.com> Signed-off-by: Uilian Ries <uilianries@gmail.com>
This commit is contained in:
@@ -7,9 +7,5 @@ conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(package REQUIRED CONFIG)
|
||||
|
||||
# Re-use the same source file from test_package folder
|
||||
add_executable(${PROJECT_NAME} ../test_package/test_package.c)
|
||||
# don't link to ${CONAN_LIBS} or CONAN_PKG::package
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE package::package)
|
||||
# in case the target project requires a C++ standard
|
||||
# target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
||||
|
@@ -37,7 +37,7 @@ class PackageConan(ConanFile):
|
||||
}
|
||||
|
||||
@property
|
||||
def _minimum_cpp_standard(self):
|
||||
def _min_cppstd(self):
|
||||
return 17
|
||||
|
||||
# in case the project requires C++14/17/20/... the minimum compiler version should be listed
|
||||
@@ -76,13 +76,13 @@ class PackageConan(ConanFile):
|
||||
def validate(self):
|
||||
# validate the minimum cpp standard supported. For C++ projects only
|
||||
if self.info.settings.compiler.cppstd:
|
||||
check_min_cppstd(self, self._minimum_cpp_standard)
|
||||
check_min_cppstd(self, self._min_cppstd)
|
||||
check_min_vs(self, 191)
|
||||
if not is_msvc(self):
|
||||
minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False)
|
||||
if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
|
||||
raise ConanInvalidConfiguration(
|
||||
f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support."
|
||||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
|
||||
)
|
||||
# in case it does not work in another configuration, it should validated here too
|
||||
if is_msvc(self) and self.info.options.shared:
|
||||
|
@@ -5,11 +5,5 @@ project(test_package LANGUAGES CXX) # if the project uses c++
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(package REQUIRED CONFIG)
|
||||
|
||||
# Re-use the same source file from test_package folder
|
||||
add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
|
||||
# don't link to ${CONAN_LIBS} or CONAN_PKG::package
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE package::package)
|
||||
# in case the target project requires a C++ standard
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
||||
|
@@ -8,9 +8,5 @@ conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(package REQUIRED CONFIG)
|
||||
|
||||
# Re-use the same source file from test_package folder
|
||||
add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
|
||||
# don't link to ${CONAN_LIBS} or CONAN_PKG::package
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE package::package)
|
||||
# in case the target project requires a C++ standard
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
||||
|
Reference in New Issue
Block a user