open-source-parsers / jsoncpp

A C++ library for interacting with JSON.
Other
8.06k stars 2.63k forks source link

Cannot statically link jsoncpp with my CMake project #1537

Open mrunix00 opened 3 months ago

mrunix00 commented 3 months ago

Describe the bug When I try to statically link jsoncpp into my project, I get the following error message:

[  3%] Linking CXX executable ../../../../bin/jsontestrunner_exe
/usr/bin/ld: cannot find -ljsoncpp_static: No such file or directory

To Reproduce Steps to reproduce the behavior:

  1. Add the following to CMakeLists.txt file:
    set(BUILD_SHARED_LIBS False)
    set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static")
  2. Run cd build && cmake .. && cmake --build .

Expected behavior Have a statically linked library

Desktop (please complete the following information):