vendredi 1 novembre 2019

why set ( CMAKE_C_FLAGS_C_FLAGS "${CMAKE_C_FLAGS} -ldl") does not work?

when my application need link pthread library,i write set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lpthread") in CmakeLists.txt and it works.but,when i need link dl lib, set ( CMAKE_C_FLAGS_C_FLAGS "${CMAKE_C_FLAGS} -ldl")does not work.if i use gcc directly,gcc sqlite3.c shell.c -lpthread -ldl works perfectly.after google,i get that target_link_libraries(MY_TARGET LIB1 LIB2 ... LIBN ${CMAKE_DL_LIBS}) works.i tried.i did work.i want to know why set(CMAKE_C_FLAGS...) does not work?

Aucun commentaire:

Enregistrer un commentaire