in

Use third party library meets error "No rule to make target"


I am trying to use third party library gflags from github, by following the instruction provided by official install.md , after doing the steps and the satic libraries would be installed in the directory /usr/local/lib and those needed header files would be /usr/local/include/

After all, by writing find_package(gflags REQUIRED) in CmakeLists.txt and I get to use everything realted to gflags.

However, If I run cmake . and make to generate staic libraried(libgflags.a, libgflags_nothreads.a ) in gflags/lib and needed header files are placed in gflags/include.

Finally, rewrite some of content in CMakeList.txt as shown below :

add_executable(classification main.cpp)

target_link_libraries( classification
                    ${OpenCV_LIBS}
                    ${InferenceEngine_LIBRARIES}
                    format_reader
                    ${CMAKE_CURRENT_SOURCE_DIR}/gflags/lib/gflags_nothreads
                    ${CMAKE_CURRENT_SOURCE_DIR}/gflags/lib/gflags
                 )

target_include_directories(classification
                        
                        PUBLIC ${CMKAE_CURRNET_SOURCE_DIR}/gflags/include/gflags
                        PUBLIC ${OpenCV_INCLUDE_DIRS}
                        PUBLIC ${InferenceEngine_INCLUDE_DIRS}
)

And the error occurs when building executable file :

*** No rule to make target 'gflags/lib/gflags_nothreads', needed by 'classification'.  Stop.

I think the only difference between what I did and officil doc is make install , I would like to know why make install is needed to get everything working ?

What if I still want to everything this locally (without make install) ,what should I to ?



Source: https://stackoverflow.com/questions/70539488/use-third-party-library-meets-error-no-rule-to-make-target

Why is urlencode not working when posting message in Arabic via Telegram bot?

Arbitrary transformations of JSON in Golang