Add bare conan package test

This commit is contained in:
Ovidiu-Florin Bogdan
2018-07-22 09:41:14 +03:00
parent 0b1facc3a8
commit 2dd53dfffc
3 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 2.8.12)
project(PackageTest CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME}
CONAN_PKG::konsole
)
# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# COMMAND example)

25
test_package/conanfile.py Normal file
View File

@@ -0,0 +1,25 @@
import os
from conans import ConanFile, CMake, tools
class KonsoleTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
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 test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sPackageTest" % os.sep)

5
test_package/main.cpp Normal file
View File

@@ -0,0 +1,5 @@
#include <iostream>
int main() {
return 0;
}