Skip to content

Commit

Permalink
Merge pull request #1 from madebr/pr_wtl
Browse files Browse the repository at this point in the history
wtl: add cmake generator in test_package
  • Loading branch information
vaerizk authored Feb 17, 2020
2 parents 6c6f477 + f26ee75 commit 4e18c23
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion recipes/wtl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conans import ConanFile, tools

import os


class WTLConan(ConanFile):
name = "wtl"
license = "MS-PL"
Expand Down
11 changes: 7 additions & 4 deletions recipes/wtl/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
cmake_minimum_required(VERSION 2.8.12)
project(WTLTest CXX)
project(test_package CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(wtl REQUIRED)

add_executable(example example.cpp)
set_property(TARGET example PROPERTY CXX_STANDARD 11)
add_executable("${PROJECT_NAME}" example.cpp)
set_property(TARGET "${PROJECT_NAME}" PROPERTY CXX_STANDARD 11)

target_link_libraries(example wtl::wtl)
target_link_libraries("${PROJECT_NAME}" wtl::wtl)
13 changes: 2 additions & 11 deletions recipes/wtl/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@

class WTLTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_find_package"

@property
def _is_multi_configuration(self):
cmake = CMake(self)
return cmake.is_multi_configuration
generators = "cmake", "cmake_find_package"

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 test(self):
if not tools.cross_building(self.settings):
bin_path = "example"
if self._is_multi_configuration:
bin_path = os.path.join(str(self.settings.build_type), bin_path)
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)

0 comments on commit 4e18c23

Please sign in to comment.