I am using the modern conan method for compiling. I am cross compiling an application and am trying to figure out how to convert my existing gcc command to conan / cmake solution.
Here is the gcc command: arm-linux-gnueabihf-gcc -Wall -static -o sctc sctc.cpp -lm -lstdc++
Pretty simple.
I have successfully built the application using conan/cmake. However it is not running, I think because I am unable to invoke add the options:
- -static
- -lm
- -lstdc++
I think. Also, would like to know how to add -Wall. How are people debugging the command lines? Any docs or blogs about it?
Here is the conanfile.py
from conans import ConanFile, tools
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
import os
class SctsConan(ConanFile):
name = "sctc"
version = "1.0.0"
license = "<Put the package license here>"
author = "<Put your name here> <And your email here>"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
generators = "compiler_args"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def requirements(self):
self.requires("fff/1.1")
self.requires("gtest/cci.20210126")
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package_info(self):
self.cpp_info.libs = ["sctc"]
Here is the profile
[settings]
os=Linux
compiler=gcc
compiler.version=9.4
compiler.libcxx=libstdc++11
build_type=Release
arch=armv6
[env]
CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++-9
Here is the CMakeFile.txt
cmake_minimum_required(VERSION 3.14)
project(sctc)
add_executable(sctc sctc.cpp )
Any pointers to documentation are welcome. I tried searching for answers but was not able to find anything that I thought relevant. I am new to conan and cmake but am enjoying working with both.
Cheers, Dave