Once Conan builds our package, it should test whether it was properly built. In order to do so, let's start by creating a test_package subdirectory in our conan directory.
It will also contain a conanfile.py script, but this time a shorter one. It should start as follows:
import os
from conans import ConanFile, CMake, tools
class CustomerTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
Nothing too fancy here. Now, we should provide the logic to build the test 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()
We'll write our CMakeLists.txt file in a sec. But first, let's write two more things: the imports method and the test method. The imports method can be...