Building project involving cmake, how do I make it aware of libraries

前端 未结 3 1753
独厮守ぢ
独厮守ぢ 2021-02-20 05:52

When I try to build this project with cmake and gcc on a 64-bit linux (debian) machine, I get an error from the linker:

Linking C executable ../../../../cpsadams         


        
相关标签:
3条回答
  • 2021-02-20 06:38

    As this question is showing up on google and both answers won't point to the correct solution here it is:

    In your CMakeLists.txt add ${CMAKE_DL_LIBS} to link against idl. It should look similar to this:

    target_link_libraries(ExpandableTest
        ${CMAKE_DL_LIBS}
        Expandable
        ExpandableTestLibrary
    )
    
    0 讨论(0)
  • 2021-02-20 06:44

    Probably you need to add target_link_libraries() - see link text

    0 讨论(0)
  • 2021-02-20 06:50

    Add this in CMakeLists.txt and it should work:

    SET (CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -ldl")
    
    0 讨论(0)
提交回复
热议问题