<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
<span>I am trying to figure out exactly what this line is for in the cmake file of the github json project here -> https://github.com/nlohmann/json/blob/develop/CMakeLists.txt#L48<br>
</span>
<div><br>
</div>
<div>add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME})<br>
</div>
<div><br>
</div>
<div>Specifically with this example, what does this allow in this cmake file that otherwise would not be possible?<br>
</div>
<div><br>
</div>
<div>The commit message where this line was added says,</div>
<div><br>
</div>
<div>"Enable target namespaces and build dir project config</div>
<div><br>
</div>
<div>CMake convention is to use a project namespace, i.e. Foo::, for imported<br>
</div>
<div>targets.  When multiple targets are imported from a project, this looks<br>
</div>
<div>like Foo::Bar1 Foo::Bar2, etc.  This adds the nlohmann_json:: namespace to<br>
</div>
<div>the exported target names.<br>
</div>
<div><br>
</div>
<div>This also allows the generated project config files to be used from the<br>
</div>
<span>build directory instead of just the install directory."</span><br>
</div>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
Removing this line appears to make no difference to any off the generated cmake files. I can still use find_package with the build directory in CMAKE_PREFIX-PATH with our without this line. Has something changed in cmake since this was added?</div>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
I am using cmake 3.10.2.</div>
<div style="margin: 0px 0px 15px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; clear: both; color: rgb(36, 39, 41); text-align: left; background-color: rgb(255, 255, 255);">
Thanks.</div>
</div>
</body>
</html>