-
Notifications
You must be signed in to change notification settings - Fork 1.9k
libxml2 - cannot build with 'msvc' compiler #13511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
abf7354
e26eb04
920b1b6
383c57f
97b2dac
4b62ea1
4ef5557
fea8b3b
ca19ad5
98d230d
647fceb
4febd3c
ca46fb1
d07a92b
b2931be
aa8ae7c
1c554b8
79b7f5b
fa23395
fd49274
eb3787d
d192fab
86dc292
417de8e
6a3198a
2555b01
a13c9b0
8e44aa6
46b10a3
31fe2d2
97866f4
31391de
bc9f330
b3d27ec
8f33399
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package C) | ||
|
||
find_package(LibXml2 REQUIRED) | ||
|
||
message("LIBXML2_FOUND: ${LIBXML2_FOUND}") | ||
message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") | ||
message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") | ||
message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") | ||
message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") | ||
message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") | ||
message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") | ||
|
||
add_executable(${PROJECT_NAME} ../test_package/test_package.c) | ||
target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
xml_path = os.path.join(self.source_folder, "..", "test_package", "books.xml") | ||
self.run(f"{bin_path} {xml_path}", env="conanrun") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(LibXml2 REQUIRED) | ||
message("LIBXML2_FOUND: ${LIBXML2_FOUND}") | ||
message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") | ||
message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") | ||
message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") | ||
message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") | ||
message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") | ||
message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") | ||
find_package(libxml2 CONFIG REQUIRED) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should actually add a Since there's an official https://cmake.org/cmake/help/latest/module/FindLibXml2.html one we need to make sure it not broken and we should test both 🤔 Does that make sense? leave the old CMakeLists.txt and duplicate the rest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's what I did in freetype recipe, it can be used as a source of inspiration to test module & config file (as well as CMake variables in module file): or libjpeg-turbo: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I be testing LIBXML2_INCLUDE_DIR and other old cmake variables in test_v1_package_module? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely a scope issue. It's not setting parent by default. I think the example space shared is a good way. Put all the code in one and add sub dir from the other. I would call it "test cmake module package" so it's more clear but that a nit Test package module implies the opposite of what it's doing in English There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've re-added the LIBXML2_INCLUDE_DIR to the test_cmake_module_package test, I'm wondering if we should test these at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure it should be tested. If it fails it means that there is an issue in libxml2 recipe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SpaceIm ok, well I am not sure if these should work at all. Yes for old v1 stuff, but from other conversations I believe the goal is to move away from old cmake variables and use modern targets etc. |
||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def build_requirements(self): | ||
if self.settings.os == "Macos" and self.settings.arch == "armv8": | ||
# Workaround for CMake bug with error message: | ||
# Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being | ||
# set. This could be because you are using a Mac OS X version less than 10.5 | ||
# or because CMake's platform configuration is corrupt. | ||
# FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. | ||
self.build_requires("cmake/3.22.0") | ||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
xml_path = os.path.join(self.source_folder, "books.xml") | ||
bin_arg_path = "%s %s" % (bin_path, xml_path) | ||
self.run(bin_arg_path, run_environment=True) | ||
self.run(f"{bin_path} {xml_path}", env="conanrun") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(LibXml2 REQUIRED) | ||
|
||
message("LIBXML2_FOUND: ${LIBXML2_FOUND}") | ||
message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") | ||
message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") | ||
message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") | ||
message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") | ||
message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") | ||
message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") | ||
|
||
add_executable(${PROJECT_NAME} ../test_package/test_package.c) | ||
target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
xml_path = os.path.join(self.source_folder, "..", "test_package", "books.xml") | ||
bin_arg_path = "%s %s" % (bin_path, xml_path) | ||
self.run(bin_arg_path, run_environment=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(LibXml2 REQUIRED) | ||
message("LIBXML2_FOUND: ${LIBXML2_FOUND}") | ||
message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") | ||
message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") | ||
message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") | ||
message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") | ||
message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") | ||
message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") | ||
|
||
add_executable(${PROJECT_NAME} ../test_package/test_package.c) | ||
target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
xml_path = os.path.join(self.source_folder, "..", "test_package", "books.xml") | ||
bin_arg_path = "%s %s" % (bin_path, xml_path) | ||
self.run(bin_arg_path, run_environment=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
versions: | ||
"2.10.3": | ||
folder: all | ||
"2.9.14": | ||
folder: all | ||
"2.9.13": | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was there before, and things that use it as a module tend to want these defined,
so I was checking with these.
Happy for them to be removed in a future PR :)