Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22209

Converting a gcc command to conan / cmake based build

$
0
0

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, toolsfrom conan.tools.cmake import CMake, CMakeToolchain, CMakeDepsimport osclass 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=Linuxcompiler=gcccompiler.version=9.4compiler.libcxx=libstdc++11build_type=Releasearch=armv6[env]CC=arm-linux-gnueabihf-gccCXX=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


Viewing all articles
Browse latest Browse all 22209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>