Skip to content

Cannot statically link jsoncpp with my CMake project #1537

@mrunix00

Description

@mrunix00

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")
  1. Run cd build && cmake .. && cmake --build .

Expected behavior
Have a statically linked library

Desktop (please complete the following information):

  • OS: Fedora 40
  • CMake version: 3.28.2
  • Meson version: 1.4.0
  • Ninja version: 1.12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuildBuild/compilation related

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions