find_library does not account for directory modification between calls
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
I have a cmake-based project and as part of it I need to build and install a 3rd party library. For this purpose, I have created a shell script which builds and install that library in a certain location. This 3rd party library is autohell based (autotools, autoconf, etc).
Logical steps performed inside my cmake script are as follows:
- Try to use FIND_PATH to locate the header files and FIND_LIBRARY to locate the library. Tolerate the not-found errors at this step
- If (1) fails, than I execute that install script which properly installs the 3rd party lib in that location. I can clearly see the headers and the libs under that target folder
- execute (1) again, this time not tolerating the errors. Now, FIND_PATH succeeded for the headers files but FIND_LIBRARY fails. Again, the *.a is in place.
Further more, if I delete all intermediate files generated by cmake (leaving the 3rd party lib intact) and execute cmake again, (1) is a success.
I suspect that cmake somehow caches the result of FIND_LIBRARY at (1) and uses it directly at (3), without really doing any search
Edited by Brad King