<div>Let's say I have many different potential names for a library and the following filesystem</div><div><br></div><div><div><div>/usr/lib/libnspr4.so</div><div>${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so</div><div><br></div>
<div>find_library(TEST_LIBRARY</div><div> NAMES nspr4 nspr4a</div><div> HINTS ${CMAKE_CURRENT_SOURCE_DIR}</div><div>)</div></div></div><div><br></div><div>I'm somewhat surprised that the following code finds /usr/lib/libnspr4.so instead of the alternate name for it (libnspr4a.so). This tells me that the loop is backwards. Shouldn't the find_library() command be iterating the list of library names across each directory. For example, the above should search:</div>
<div><br></div><div>First ${CMAKE_CURRENT_SOURCE_DIR}...</div><div> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so</div><div><div> ${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so</div></div><div>Then the system directories...</div><div>
(system paths)/lib/libnspr4.so</div><div><div> (system paths)/lib/libnspr4a.so</div></div><div>Etc.</div><div><br></div><div>The system is actually searching</div><div>${CMAKE_CURRENT_SOURCE_DIR}/libnspr4.so</div><div>
/usr/lib/libnspr4.so</div><div>${CMAKE_CURRENT_SOURCE_DIR}/libnspr4a.so</div><div>/usr/lib/libnspr4a.so</div><div><br></div><div>This is with CMake 2.8.2</div><div><br></div><div>-- <br>Philip Lowman<br>
</div>