Skip to content

cmake出错Target "iot_hal" of type OBJECT_LIBRARY may not be linked into another target #159

@yanggeorge

Description

@yanggeorge

cmake config 出错。

错误出在wrappers下的CMakeFiles.txt中

FILE (GLOB wrappers_SRCS

)

ADD_LIBRARY (iot_hal OBJECT    # <--- 这里有错误
    ${wrappers_SRCS}
    ${EXTRA_C_SOURCES}
)

问题:

➜  build git:(v3.0.1) ✗ cmake ../
-- The C compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
---------------------------------------------------------------------
Project Name              : iotkit-embedded-V3.0.1
Source Dir                : /home/ym/work/iotkit-embedded
Binary Dir                : /home/ym/work/iotkit-embedded/build
System Processor          : x86_64
System Platform           : Linux-5.0.0-23-generic
C Compiler                : /usr/bin/cc
Executable Dir            : /home/ym/work/iotkit-embedded/build/bin
Library Dir               : /home/ym/work/iotkit-embedded/build/lib
SDK Version               : V3.0.1

Building on LINUX ...
---------------------------------------------------------------------
You have called ADD_LIBRARY for library iot_hal without any source files. This typically indicates a problem with your CMakeLists.txt file
CMake Error at CMakeLists.txt:83 (TARGET_LINK_LIBRARIES):
  Target "iot_hal" of type OBJECT_LIBRARY may not be linked into another
  target.  One may link only to STATIC or SHARED libraries, or to executables
  with the ENABLE_EXPORTS property set.

重现步骤:

git clone https://github.com/aliyun/iotkit-embedded.git
cd iotkit-embedded
make config
make cmake 
mkdir build
cd build
cmake ../

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions