Skip to content
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

full cmake_build_module editables functional test #17214

Merged
Prev Previous commit
Next Next commit
added file.txt loading
  • Loading branch information
memsharded committed Oct 24, 2024
commit a4c01bd8796da84b1673835826a2f87245d1a379
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,12 @@ class Conan(ConanFile):
exports_sources = ["*.cmake"]

def build(self):
cmake = 'function(otherfunc)\nmessage("Hello otherfunc!!!!")\nendfunction()'
cmake = 'set(MY_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR})\n'\
'macro(otherfunc)\n'\
'file(READ "${MY_CMAKE_PATH}/my.txt" c)\n'\
'message("Hello ${c}!!!!")\nendmacro()'
save(self, "otherfuncs.cmake", cmake)
save(self, "my.txt", "contents of text file!!!!")

def layout(self):
self.folders.source = "my_sources"
Expand All @@ -234,6 +238,7 @@ def layout(self):
def package(self):
copy(self, "*.cmake", self.source_folder, os.path.join(self.package_folder, "mods"))
copy(self, "*.cmake", self.build_folder, os.path.join(self.package_folder, "mods"))
copy(self, "*.txt", self.build_folder, os.path.join(self.package_folder, "mods"))

def package_info(self):
self.cpp_info.set_property("cmake_build_modules", glob.glob("mods/*.cmake"))
Expand Down Expand Up @@ -277,4 +282,4 @@ def build(self):
c.run("create functions")
c.run("build app")
assert "Hello myfunction!!!!" in c.out
assert "Hello otherfunc!!!!" in c.out
assert "Hello contents of text file!!!!" in c.out