When I run FindPackage(PythonLibs)
, it finds the static python library first, python3.5m.a, rather than python3.5m.so. Is this the expected behavior of CMake? I suspect that it is not as per CMake bug report; however, this bug report was submitted in 2005. Things change over 13 years. If shared libraries have preference then any idea why CMake would find a static library over a shared one?
I have already fixed the build issue by just telling CMake where the proper library is for my own build using the SET()
command. I'm looking for an answer which leads to a better understanding of CMake's behavior in this context because I'm trying to solve a different problem, and finding the static over the shared library seemed odd to me.
Thanks!
System/Problem Information:
- Ubuntu 16.04, 64 bit
- Compiled Python 3.5.5 with enabled-shared
- CMake 3.11.0
- Edit as per Tsyvarev comment: the shared and static libraries are in the same directory
If you look at the cmake files, specifically FindPythonLibs.cmake (CMake 3.11.0) at lines 142-163, it looks to me that it finds the shared library then the static, but again I'm not an expert at CMake (it is a CMake noob trying to pick out what the source code does with very little context).
Thank you for taking time from your day to read this question. Any help is appreciated.
Edit: 4/13/18
Well, this is interesting. I checked the CMAKE_FIND_LIBRARY_SUFFIXES variable, and the value was: ".so.a". This is almost becoming interesting enough for me to figure out how to debug CMake files as per this question/answer. When/If I get around to it, I'll update my post again.
Edit 4/16/18
Well, I started gearing up to do the debugging process. As I was gearing up, I figured out the mistake. I forgot to delete the CMakeCache.txt when I built the shared version of python 3.5.5, so the FIND_PACKAGE command was not re-running. Thank you for taking your time replying to this question, Tsyvarev. I learned something new.