[CMake] Forcing CMake to find static library
Hello, I am trying to force CMAKE to include a specific static lapack library, set through the environment variable $LAPACK_LIB: > ls $LAPACK_LIB libblas_extra.a libcblas.a liblapack.a liblapacke.a libtmglib.a > echo $LAPACK_LIB /bgsys/local/lapack/3.7.0/lib This is how I am trying to do it in CMake: cmake_minimum_required(VERSION 2.5) project(TEST) file(GLOB_RECURSE sources src/*.f90) add_executable(cmake.x ${sources}) find_library(MY_LAPACK liblapack.a HINTS $ENV{LAPACK_LIB} NO_CMAKE_LIBRARY_PATH) MESSAGE(STATUS "Lapack location: ${MY_LAPACK}") target_link_libraries(cmake.x ${MY_LAPACK} ${MY_ESSL}) enable_language(Fortran) If I run CMake this results in: > cmake . -- Lapack location: /usr/lib64/liblapack.so -- Configuring done -- Generating done -- Build files have been written to: /work/jias12/jias1217/lapack_test How can I force CMake to find the correct library file and not some random one laying around on the system? Kind regards Matthias Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Compiling Fortran on IBMs XL
I found that by setting: set(CMAKE_EXE_LINKER_FLAGS "-qmkshrobj") I can include this fix for older verison. set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj") Didn't actually have any effect on the linker flags. Kind regards Matthias Redies On 07.06.2017 17:02, Matthias Redies wrote: Hello, I am trying to compile my program using this CMake script: https://pastebin.com/zgJhbFhj with ifort or gfortran my script works fine, but with IBMs XL Fortran I get an error: > make -- A library with BLAS API found. -- A library with LAPACK API found. -- MKLROOT: -- IBM -- DEBUG Flag -g -C -- Flags: -O2 -qarch=qp -qtune=qp -ufmt_littleendian={23} -- cmake_module_path:/homea/jias12/jias1217/STB/cmake/Modules/ -- Configuring done -- Generating done -- Build files have been written to: /homea/jias12/jias1217/STB Linking Fortran executable stb.x /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/bin/ld: -f may not be used without -shared make[2]: *** [stb.x] Error 1 make[1]: *** [CMakeFiles/stb.x.dir/all] Error 2 make: *** [all] Error 2 I believe my Error was discussed in: http://public.kitware.com/pipermail/cmake/2015-January/059522.html and solved here: http://public.kitware.com/pipermail/cmake/2015-January/059547.html https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4729547a However, I am working on a cluster where the only available version is: cmake version 2.8.12.2 In line 41&42 I tried to implement this bug fix in my script, but this didn't work. How can I get my program to compile on version 2.8.12.2? Kind regards Matthias Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Compiling Fortran on IBMs XL
Hello, I am trying to compile my program using this CMake script: https://pastebin.com/zgJhbFhj with ifort or gfortran my script works fine, but with IBMs XL Fortran I get an error: > make -- A library with BLAS API found. -- A library with LAPACK API found. -- MKLROOT: -- IBM -- DEBUG Flag -g -C -- Flags: -O2 -qarch=qp -qtune=qp -ufmt_littleendian={23} -- cmake_module_path:/homea/jias12/jias1217/STB/cmake/Modules/ -- Configuring done -- Generating done -- Build files have been written to: /homea/jias12/jias1217/STB Linking Fortran executable stb.x /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/bin/ld: -f may not be used without -shared make[2]: *** [stb.x] Error 1 make[1]: *** [CMakeFiles/stb.x.dir/all] Error 2 make: *** [all] Error 2 I believe my Error was discussed in: http://public.kitware.com/pipermail/cmake/2015-January/059522.html and solved here: http://public.kitware.com/pipermail/cmake/2015-January/059547.html https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4729547a However, I am working on a cluster where the only available version is: cmake version 2.8.12.2 In line 41&42 I tried to implement this bug fix in my script, but this didn't work. How can I get my program to compile on version 2.8.12.2? Kind regards Matthias Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake