You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CMakeLists.txt pulls in the submodules with add_subdirectory(). By default INJA_USE_EMBEDDED_JSON is ON, and this results in the following CMake error:
CMake Error at lib/inja/CMakeLists.txt:42 (add_library):
add_library cannot create target "nlohmann_json" because another target
with the same name already exists. The existing target is an interface
library created in source directory
"/home/sam/GitHub/samwarring/nlf/lib/json". See documentation for policy
CMP0002 for more details.
This makes sense, since I've provided my own copy of nlohmann/json. However, if I set INJA_USE_EMBEDDED_JSON to OFF, I still get an error at generate-time:
-- Configuring done
CMake Error: install(EXPORT "injaTargets" ...) includes target "inja" which requires target "nlohmann_json" that is not in any export set.
CMake Error in lib/inja/CMakeLists.txt:
export called with target "inja" which requires target "nlohmann_json" that
is not in any export set.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
After disabling INJA_EXPORT and INJA_INSTALL, I'm still getting the above error. I think this is due to CMakeLists.txt:141 and CMakeLists:144, which have naked install and export commands that aren't wrapped with if (INJA_INSTALL) and if (INJA_EXPORT). I found wrapping those commands with if-statements fixes the problem. This might be the correct fix, but I could be misunderstanding.
The text was updated successfully, but these errors were encountered:
I should have checked the commit and issue history 🤦♂️ Looks like it's already reported in #237 and fixed on master. I was using the latest official release so I didn't see the change
My project includes both inja and nlohmann/json as git submodules.
CMakeLists.txt pulls in the submodules with
add_subdirectory()
. By defaultINJA_USE_EMBEDDED_JSON
isON
, and this results in the following CMake error:This makes sense, since I've provided my own copy of nlohmann/json. However, if I set
INJA_USE_EMBEDDED_JSON
toOFF
, I still get an error at generate-time:After disabling
INJA_EXPORT
andINJA_INSTALL
, I'm still getting the above error. I think this is due to CMakeLists.txt:141 and CMakeLists:144, which have nakedinstall
andexport
commands that aren't wrapped withif (INJA_INSTALL)
andif (INJA_EXPORT)
. I found wrapping those commands with if-statements fixes the problem. This might be the correct fix, but I could be misunderstanding.The text was updated successfully, but these errors were encountered: