find_library returns same lib<name>.so for all <name> in list
I am using cmake 3.12 with visual studio 2017 linux dev workloads.
I am using the following CMakeLists.txt:
# ....
# openfoam part
set(OF_LIB_LIST finiteVolume meshTools OpenFOAM)
foreach(of_libname IN LISTS OF_LIB_LIST)
message("Trying to find OpenFOAM library ${of_libname}")
find_library(of_lib_path ${of_libname} HINTS $ENV{FOAM_LIBBIN} $ENV{FOAM_USER_LIBBIN} )
if(NOT of_lib_path)
message(WARNING "${of_libname} NOT FOUND in $ENV{FOAM_LIBBIN} and $ENV{FOAM_USER_LIBBIN}.")
continue()
else()
message("OpenFOAM library ${of_libname} is FOUND as ${of_lib_path}.")
target_link_libraries(${PROJECT_NAME} PUBLIC ${of_lib_path})
endif()
endforeach()
# ....
Here is part of the output:
1> 2:38:16 PM: Copying files to remote machine...
1> 2:38:18 PM: Finished copying files (elapsed time 00h:00m:01s:690ms).
1> /opt/cmake/3.12.0/bin/cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Debug" "/var/tmp/src/5c7c854c-52b0-3333-9ad3-b92a426ff573/Linux-Debug/CMakeLists.txt";
1> Trying to find OpenFOAM library finiteVolume
1> OpenFOAM library finiteVolume is FOUND as /opt/openfoam6/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so.
1> Trying to find OpenFOAM library meshTools
1> OpenFOAM library meshTools is FOUND as /opt/openfoam6/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so.
1> Trying to find OpenFOAM library OpenFOAM
1> OpenFOAM library OpenFOAM is FOUND as /opt/openfoam6/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so.
1> -- Configuring done
1> -- Generating done
1> -- Build files have been written to: /var/tmp/build/5c7c854c-52b0-3333-9ad3-b92a426ff573/build/Linux-Debug
1> Starting CMake target info extraction ...
1> Extracted includes paths.
1> Extracted CMake variables.
1> Extracted source files and headers.
1> Extracted global settings.
1> Extracted code model.
1> Collating data ...
1> Target info extraction done.
They all return libOpenFOAM.so
Edited by Craig Scott