Skip to content

Commit

Permalink
Add CMake wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jwillikers committed Jul 16, 2022
1 parent 08305de commit 49ace14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 8 additions & 0 deletions recipes/dbus/1.x.x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/cmake/modules")
add_subdirectory("source_subfolder/cmake")
11 changes: 2 additions & 9 deletions recipes/dbus/1.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class DbusConan(ConanFile):
topics = ("dbus")

settings = "os", "arch", "compiler", "build_type"
exports_sources = ["CMakeLists.txt"]
options = {
"system_socket": "ANY",
"system_pid_file": "ANY",
Expand Down Expand Up @@ -82,18 +83,10 @@ def _configure_cmake(self):
# Define EXPAT_LIBRARIES to be the expat::expat target provided by Conan to fix linking.
self._cmake.definitions["EXPAT_LIBRARIES"] = "expat::expat"

path_to_cmake_lists = os.path.join(self._source_subfolder, "cmake")

self._cmake.configure(source_folder=path_to_cmake_lists,
build_folder=self._build_subfolder)
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

def build(self):
replace_in_file(
self,
os.path.join(self._source_subfolder, "cmake", "CMakeLists.txt"),
"project(dbus)",
"project(dbus)\ninclude(../../conanbuildinfo.cmake)\nconan_basic_setup()")
cmake = self._configure_cmake()
cmake.build()

Expand Down

0 comments on commit 49ace14

Please sign in to comment.