-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update recipe to Conan 2.x. --------- Co-authored-by: kristoffere <[email protected]> Co-authored-by: Lars T. Kyllingstad <[email protected]>
- Loading branch information
1 parent
08d15f6
commit 10ef51e
Showing
4 changed files
with
89 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(PackageTest CXX) | ||
cmake_minimum_required(VERSION 2.8.12) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(fmilibrary CONFIG REQUIRED) | ||
|
||
add_executable(test test.cpp) | ||
target_link_libraries(test ${CONAN_LIBS} ${CMAKE_DL_LIBS}) | ||
target_link_libraries(test fmilibrary::fmilibrary ${CMAKE_DL_LIBS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.files import copy | ||
from conan.tools.build import can_run | ||
|
||
|
||
class FmilibraryTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
generators = "CMakeDeps", "CMakeToolchain" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is | ||
# in "test_package" | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def imports(self): | ||
self.copy("*.dll", dst="bin", src="bin") | ||
self.copy("*.dylib*", dst="bin", src="lib") | ||
self.copy('*.so*', dst='bin', src='lib') | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
os.chdir("bin") | ||
self.run(".%stest" % os.sep) | ||
if can_run(self): | ||
cmd = os.path.join(self.cpp.build.bindir, "test") | ||
self.run(cmd, env="conanrun") |