I'm a huge beginner to C and CMake, so apologies if I've missed anything obvious.
I try to link cJSON like this:
# CMakeLists.txt
cmake_minimum_required(VERSION 3.28)
project(myproj VERSION 0.0.1
LANGUAGES C
)
find_package( CURL REQUIRED )
find_package( cJSON REQUIRED )
add_executable(myproj myproj.c)
target_link_libraries( myproj CURL::libcurl )
target_link_libraries( myproj cJSON::cjson )
It won't build, despite having it installed:
theo@dev ~/myproj (main)> cmake -B build
-- Configuring done (0.1s)
CMake Error at CMakeLists.txt:11 (target_link_libraries):
Target "myproj" links to:
cJSON::cjson
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done (0.0s)
CMake Generate step failed. Build files cannot be regenerated correctly.
theo@dev ~/myproj (main) [1]> ls /usr/lib/cmake/cJSON
cJSONConfig.cmake cJSONConfigVersion.cmake cjson-noconfig.cmake cjson.cmake cjson_utils-noconfig.cmake cjson_utils.cmake
I'm a huge beginner to C and CMake, so apologies if I've missed anything obvious.
I try to link cJSON like this:
It won't build, despite having it installed: