<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Am 07.11.19 um 18:01 schrieb samyuktar:<br>
    <blockquote type="cite"
      cite="mid:1573146101480-0.post@n2.nabble.com">
      <pre class="moz-quote-pre" wrap="">SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER}  ${CMAKE_C_FLAGS}
--c_file=../main.c -z --map_file=${TARGET_NAME}.map
--output_file=${TARGET_NAME} ${PLATFORM_CONFIG_L_FLAGS} ${CMD_SRCS}   ${LIB}
--include_path ${LWIP_INCLUDE_DIR} --verbose <OBJECTS>"  CACHE STRING
"linker executable")</pre>
    </blockquote>
    <p>As far as I can tell, you are trying to combine the compile and
      link steps, but CMake expects these to be separate steps.
      Furthermore, cmake knows about the TI compiler (see
      <...>/share/cmake-3.xx/Modules/Compiler/TI-C.cmake and
      friends), so you shouldn't need to mess around with
      CMAKE_C_LINK_EXECUTABLE - let cmake handle that for you. The flags
      you need for linking that cmake doesn't already add for you by
      default should go into CMAKE_EXE_LINKER_FLAGS_<CONFIG>_INIT
      (see the cmake documenation for details), or be set using the
      add_link_options and/or target_link_options commands (again, see
      the cmake documentation for details).</p>
    <blockquote type="cite">
      <pre class="moz-quote-pre" wrap="">[ 50%] Building C object CMakeFiles/test.dir/main.c.o
/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl 
-I/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include 
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk   -o
CMakeFiles/test.dir/main.c.o   -c /Users/sramnath/lwip_blinky/lwip/main.c
</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">WARNING: object file specified, but linking not enabled
</pre>
        </blockquote>
      </blockquote>
    </blockquote>
    <p>That compiler invocation looks wrong - I'm pretty sure the TI
      compiler doesn't use the MacOS10.14.sdk sysroot. I think what's
      happening here is that you set your toolchain settings
      (CMAKE_C_COMPILER and friends) after the project() command - but
      the project() command tells cmake to check what compiler you are
      using to figure out how it must be called, and it is using your
      host system's compiler (probably Apple's clang) to do so. You
      should put the toolchain definitions into a toolchain file as
      described in the cmake-toolchains(7) documentation and tell cmake
      to use it my specifying -DCMAKE_TOOLCHAIN_FILE=<path to your
      toolchain file> on the cmake command line.<br>
    </p>
    <p>I once played around a bit with cgtools 5.2.9 for Arm using the
      following toolchain file:</p>
    <p>--- SNIP ---<br>
    </p>
    <p><tt># TI cgt-arm_5.2.9 cmake toolchain script</tt><tt><br>
      </tt><tt>#</tt><tt><br>
      </tt><tt># This file is based on the cmake-toolchains(7)
        documentation.</tt><tt><br>
      </tt><tt><br>
      </tt><tt># Set the operating system and processor architecture</tt><tt><br>
      </tt><tt>set(CMAKE_SYSTEM_NAME Generic)</tt><tt><br>
      </tt><tt>set(CMAKE_SYSTEM_PROCESSOR arm)</tt><tt><br>
      </tt><tt>set(CMAKE_SYSTEM_VERSION 1)</tt><tt><br>
      </tt><tt><br>
      </tt><tt># Setup CMake's rules for using the CMAKE_FIND_ROOT_PATH
        for cross-compilation</tt><tt><br>
      </tt><tt>set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)</tt><tt><br>
      </tt><tt>set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)</tt><tt><br>
      </tt><tt>set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)</tt><tt><br>
      </tt><tt>set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)</tt><tt><br>
      </tt><tt><br>
      </tt><tt># TI cgtools command line programs</tt><tt><br>
      </tt><tt>set(SDK_PATH "/proj/he/opt/ti/ti-cgt-arm_5.2.9")</tt><tt><br>
      </tt><tt>set(SDK_BIN "${SDK_PATH}/bin")</tt><tt><br>
      </tt><tt><br>
      </tt><tt># This compiler doesn't work with CMAKE_SYSROOT, but we
        do need to set our</tt><tt><br>
      </tt><tt># CMAKE_FIND_ROOT_PATH. Note that setting a variable will
        override the value in</tt><tt><br>
      </tt><tt># the cache if the CACHE option was not used, so if we
        want to be able to use a</tt><tt><br>
      </tt><tt># CMAKE_FIND_ROOT_PATH passed to cmake via the command
        line, we must make sure</tt><tt><br>
      </tt><tt># not to overwrite any value that was already set.</tt><tt><br>
      </tt><tt>if(NOT CMAKE_FIND_ROOT_PATH)</tt><tt><br>
      </tt><tt>  set(CMAKE_FIND_ROOT_PATH ${SDK_PATH})</tt><tt><br>
      </tt><tt>endif()</tt><tt><br>
      </tt><tt><br>
      </tt><tt>set(CMAKE_C_COMPILER "${SDK_BIN}/armcl")</tt><tt><br>
      </tt><tt>set(CMAKE_CXX_COMPILER "${SDK_BIN}/armcl")</tt><tt><br>
      </tt><tt>set(CMAKE_ASM_COMPILER "${SDK_BIN}/armasm")</tt><tt><br>
      </tt><tt>set(CMAKE_AR "${SDK_BIN}/armar")</tt><tt><br>
      </tt><tt>set(CMAKE_LINKER "${SDK_BIN}/armlnk")</tt><tt><br>
      </tt><tt><br>
      </tt><tt>string(CONCAT ARCH_C_FLAGS</tt><tt><br>
      </tt><tt>  "-mv=7A8 --abi=eabi -me --float_support=VFPv3 --neon
        --printf_support=full")</tt><tt><br>
      </tt><tt>set(CMAKE_C_FLAGS_INIT "${ARCH_C_FLAGS}")</tt><tt><br>
      </tt><tt>set(CMAKE_CXX_FLAGS_INIT "${ARCH_C_FLAGS}")</tt><tt><br>
      </tt></p>
    <p><tt># Normally, cmake checks if the compiler can compile and link
        programs. For</tt><tt><br>
      </tt><tt># TI's cgtools the link step doesn't work, and there
        seems to be no easy way</tt><tt><br>
      </tt><tt># to fix this. Instead, we simply disable the compiler
        checks for C and C++.</tt><tt><br>
      </tt><tt>set(CMAKE_C_COMPILER_WORKS 1)</tt><tt><br>
      </tt><tt>set(CMAKE_CXX_COMPILER_WORKS 1)</tt><br>
    </p>
    <p>--- SNIP ---<br>
    </p>
    <p>Note that the project this was intended for thankfully never got
      anywhere so I didn't pursue this much further than being able to
      compile libz with it ("thankfully" because the TI compiler is
      pretty awful).<br>
    </p>
    <div class="moz-signature">-- <br>
      <div style="width:480px; text-align: left; font-family: Arial,
        Helvetica, sans-serif;">
        <p style="color: #062d64; font-size: 14px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;">
          <b>Dr. Eric Dönges</b>
          <br>
          Senior Software Engineer
        </p>
        <p style="color: #062d64; font-size: 12px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;">MVTec Software
          GmbH | Arnulfstr. 205 | 80634 Munich | Germany
          <br>
          <a style="font-size: 12px; font-family: Arial, Helvetica,
            sans-serif; color: #062d64;"
            href="mailto:mustermann@mvtec.com">doenges@mvtec.com</a> |
          Tel: +49 89 457 695-0 | <a style="font-size: 12px;
            font-family: Arial, Helvetica, sans-serif; color: #062d64;"
            href="http://www.mvtec.com">www.mvtec.com</a>
          <br>
        </p>
        <p>
          <span style="font-size: 12px; font-family: Arial, Helvetica,
            sans-serif; color: #062d64;">Find our privacy policy <a
              style="font-size: 12px; font-family: Arial, Helvetica,
              sans-serif; color: #062d64;"
              href="https://www.mvtec.com/imprint">here</a>.</span> </p>
        <p style="color: #062d64; font-size: 12px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;"><img
src="https://mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/newsletter-icon.png"
            valign="bottom" width="16" height="16"> <a style="font-size:
            12px; font-family: Arial, Helvetica, sans-serif; color:
            #062d64; font-weight: bold;"
            href="https://www.mvtec.com/newsletter">Sign up</a> for our
          MVTec Newsletter!</p>
        <p style="margin: 0px; color: #666; font-size: 12px; text-align:
          left; font-family: Arial, Helvetica, sans-serif;">Geschäftsführer:
          Dr. Wolfgang Eckstein, Dr. Olaf Munkelt<br>
          Amtsgericht München HRB 114695</p>
        <p style="margin: 0px; color: #666; font-size: 12px; text-align:
          left; font-family: Arial, Helvetica, sans-serif;"> </p>
        <img
src="https://www.mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/mvtec-logo-line.png"
          alt="MVTec Software GmbH Logo"></div>
    </div>
  </body>
</html>