mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-06-25 21:03:11 +00:00
tinyspline: CMake 4 support (#27112)
* tinyspline: CMake 4 support * Added missing cmake policy to version 0.2.0
This commit is contained in:
@ -7,7 +7,7 @@ from conan.tools.scm import Version
|
|||||||
import os
|
import os
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
required_conan_version = ">=1.53.0"
|
required_conan_version = ">=2.1"
|
||||||
|
|
||||||
class TinysplineConan(ConanFile):
|
class TinysplineConan(ConanFile):
|
||||||
name = "tinyspline"
|
name = "tinyspline"
|
||||||
@ -17,7 +17,7 @@ class TinysplineConan(ConanFile):
|
|||||||
topics = ("tinyspline ", "nurbs", "b-splines", "bezier")
|
topics = ("tinyspline ", "nurbs", "b-splines", "bezier")
|
||||||
homepage = "https://github.com/msteinbeck/tinyspline"
|
homepage = "https://github.com/msteinbeck/tinyspline"
|
||||||
url = "https://github.com/conan-io/conan-center-index"
|
url = "https://github.com/conan-io/conan-center-index"
|
||||||
|
package_type = "library"
|
||||||
settings = "os", "arch", "compiler", "build_type"
|
settings = "os", "arch", "compiler", "build_type"
|
||||||
options = {
|
options = {
|
||||||
"shared": [True, False],
|
"shared": [True, False],
|
||||||
@ -78,6 +78,7 @@ class TinysplineConan(ConanFile):
|
|||||||
tc.variables["TINYSPLINE_DISABLE_PYTHON"] = True
|
tc.variables["TINYSPLINE_DISABLE_PYTHON"] = True
|
||||||
tc.variables["TINYSPLINE_DISABLE_R"] = True
|
tc.variables["TINYSPLINE_DISABLE_R"] = True
|
||||||
tc.variables["TINYSPLINE_DISABLE_RUBY"] = True
|
tc.variables["TINYSPLINE_DISABLE_RUBY"] = True
|
||||||
|
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
|
||||||
else:
|
else:
|
||||||
tc.variables["TINYSPLINE_WARNINGS_AS_ERRORS"] = False
|
tc.variables["TINYSPLINE_WARNINGS_AS_ERRORS"] = False
|
||||||
tc.variables["TINYSPLINE_ENABLE_CXX"] = self.options.cxx
|
tc.variables["TINYSPLINE_ENABLE_CXX"] = self.options.cxx
|
||||||
@ -162,9 +163,3 @@ class TinysplineConan(ConanFile):
|
|||||||
# Workaround to always provide a global target or pkg-config file with all components
|
# Workaround to always provide a global target or pkg-config file with all components
|
||||||
self.cpp_info.set_property("cmake_target_name", "tinyspline-do-not-use")
|
self.cpp_info.set_property("cmake_target_name", "tinyspline-do-not-use")
|
||||||
self.cpp_info.set_property("pkg_config_name", "tinyspline-do-not-use")
|
self.cpp_info.set_property("pkg_config_name", "tinyspline-do-not-use")
|
||||||
|
|
||||||
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
|
|
||||||
self.cpp_info.components["libtinyspline"].names["cmake_find_package"] = "tinyspline"
|
|
||||||
if self.options.cxx:
|
|
||||||
self.cpp_info.components["libtinysplinecxx"].build_modules["cmake_find_package"] = [self._module_file_rel_path]
|
|
||||||
self.cpp_info.components["libtinysplinecxx"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from conan import ConanFile
|
from conan import ConanFile
|
||||||
from conan.tools.build import cross_building
|
from conan.tools.build import can_run
|
||||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -25,12 +25,10 @@ class TestPackageConan(ConanFile):
|
|||||||
cmake.build()
|
cmake.build()
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
if not cross_building(self):
|
if can_run(self):
|
||||||
bin_c_path = os.path.join(self.cpp.build.bindirs[0], "test_package_c")
|
bin_c_path = os.path.join(self.cpp.build.bindir, "test_package_c")
|
||||||
self.run(bin_c_path, run_environment=True)
|
self.run(bin_c_path, env="conanrun")
|
||||||
|
|
||||||
# TODO: rely on self.dependencies["tinyspline"].options.cxx in CONAN_V2 mode
|
if self.dependencies["tinyspline"].options.cxx:
|
||||||
# see https://github.com/conan-io/conan/issues/11940#issuecomment-1223940786
|
bin_cpp_path = os.path.join(self.cpp.build.bindir, "test_package_cpp")
|
||||||
bin_cpp_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp")
|
self.run(bin_cpp_path, env="conanrun")
|
||||||
if os.path.exists(bin_cpp_path):
|
|
||||||
self.run(bin_cpp_path, run_environment=True)
|
|
||||||
|
Reference in New Issue
Block a user