Re: [CMake] Why is XXX_INCLUDE_DIRS plural and should it be deep?
My $0.02..I just completed a CMake system for a code project that required several TPLs (third party libraries) two of which were the NetCDF and HDF5. I struggled with the same problems you mention here. When I wrote my FindXXX modules, the standard I adopted was, XXX_INCLUDE_DIR only contained the path to the XXX include directory while XXX_INCLUDE_DIRS contained XXX include directory any other TPL include directory required to compile. Parts of the code was calling NetCDF directly but not HDF5. I wanted the project CMakeLists.txt files to be as clean as possible and placed the logic to determine if NetCDF had HDF5 and adjusted the NetCDF_INCLUDE_DIRS if needed in our FindNetCDF module. This allowed the developers to simply put find_package(NetCDF) include_directories(NetCDF_INCLUDE_DIRS) in their CMakeLists.txt files not worry about testing for HDF5, etc. This complicated the FindNetCDF module, but I think it improved the stability of our CMake system. If you decide not to cascade, then you will need to provide a flag like you mention in (1) to help out whoever calls your module, so they can call find_package(HDF5) when needed. When NetCDF split the language APIs, I used the FindMPI module as a template and created NetCDF_C_* NetCDF_CXX_* NetCDF_Fortran_* variables in the FindNetCDF module. You may what to look at how that module handles different language libraries and include directories for inspiration. Good luck! On 12/12/12 17:35, esatel wrote: Hi all, I am trying to adapt an existing FindNetCDF.cmake file to work with NetCDF 4.2. I have read the Modules/Readme.txt but I am still a little unclear to the best approach in my case. In 4.2 the Fortran bindings and C bindings are not necessarily installed in the same place. One motive for NetCDF_INCLUDE_DIRS to be plural is that there might be a NetCDF_C_INCLUDE_DIR and a NetCDF_Fortran_INCLUDE_DIR that together form NetCDF_INCLUDE_DIRS. There is a second motive that I am less clear on. The FindNetCDF.cmake files I have seen handle the HDF5 dependency differently: 1. One sets a variable NETCDF_HAS_HDF5 by querying a config executable but does nothing else. 2. The other sets a similar variable but then does find_package on HDF5 and loads the dependencies into NetCDF_INCLUDE_DIRS and NetCDF_LIBRARIES. This design (2) cascades. FindHDF5.cmake represents a similar decision about whether to find_package its dependencies like the zlib compression library. I believe the one in the cmake distro doesn't do that. What is the best practice here? To handle dual locations for the library at hand or to accumulate or both? The first seems unavoidable ... the second seems to be an unevenly applied standard. Thanks Eli -- View this message in context: http://cmake.3232098.n2.nabble.com/Why-is-XXX-INCLUDE-DIRS-plural-and-should-it-be-deep-tp7582623.html Sent from the CMake mailing list archive at Nabble.com. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Lori A. Pritchett-Sheats, PhD. CCS-2, Computational Physics and Methods Office: 505-665-6675 Fax: 505-665-4972 Los Alamos National Laboratory P.O. Box 1663 MS D413 Los Alamos, NM 87544 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Problem with FortranCInterface_VERIFY and the Nag Fortran Compiler
I've run into a problem using the FortranCInterface_VERIFY macro with the Nag Fortran compiler. If the Fortran compiler flags contain the '-g90' option, it fails because Nag tries to write a debug file (*.g90) to the same directory as the source Fortran file. In most cases, a user does not have write permission in the CMake installation location and the compile fails. I can not control where Nag writes these debug files. Suggestions on how to work around this other than skipping this test if using Nag with the '-g90' option? Example CMakeLists.txt file: cmake_minimum_required(VERSION 2.8) project(Foo C Fortran) include(FortranCInterface) FortranCInterface_VERIFY() Error Output: Building Fortran object CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o redacted/nag/5.2.724/bin/nagfor -g90 -Iredacted/foo/CMakeFiles/FortranCInterface/VerifyC-c /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.f -o CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o NAG Fortran Compiler Release 5.2(724) Obsolescent: /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.f, line 1: Fixed source form Fatal Error: /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.f: Cannot create file /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FortranCInterface/Verify/VerifyFortran.g90 gmake[2]: *** [CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o] Error 2 gmake[2]: Leaving directory `redacted/foo/CMakeFiles/FortranCInterface/VerifyC' gmake[1]: *** [CMakeFiles/VerifyFortran.dir/all] Error 2 gmake[1]: Leaving directory `redacted/foo/CMakeFiles/FortranCInterface/VerifyC' gmake: *** [all] Error 2 -- Lori A. Pritchett-Sheats, PhD. CCS-2, Computational Physics and Methods Office: 505-665-6675 Fax: 505-665-4972 Los Alamos National Laboratory P.O. Box 1663 MS D413 Los Alamos, NM 87544 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Running Python unit tests importing modules built in CMake
The ENVIRONMENT property worked for me. Thank you! And I will look at the python virtual environment. On 05/03/12 07:12, Bradley Lowekamp wrote: Hello, For testing python another alternative is to create a python virtual environment and install you python package into that. Here is an example of how I have done that: https://github.com/SimpleITK/SimpleITK/blob/master/Wrapping/CMakeLists.txt#L97 Brad On May 2, 2012, at 9:26 PM, David Cole wrote: Are you using add_test to add the tests in the CMakeLists file? If so, you can set the test ENVIRONMENT property to set PYTHONPATH when ctest executes the test. See property doc here: http://cmake.org/cmake/help/v2.8.8/cmake.html#prop_test:ENVIRONMENT On Wed, May 2, 2012 at 5:17 PM, Lori A. Pritchett-Sheats lpri...@lanl.gov mailto:lpri...@lanl.gov wrote: I'm building Python modules using SWIG and CMake, and have run into a problem running Python unit tests for these built modules. I can not find a slick way to set the Python module search path when running the test. The usual trick of setting sys.path in the scripts will not work here because I don't know the location of the build directory. I've tried updating PYTHONPATH in my CMakeList.txt file but that change isn't picked up when the test is executed. I could create the unit test modules at build time using CONFIGURE_FILE replacing @CMAKE_CURRENT_BINARY_DIR@ in a sys.path line, but that seems heavy-handed. Has anyone else run into this problem and found better a solution? -- Lori A. Pritchett-Sheats, PhD. CCS-2, Computational Physics and Methods Office: 505-665-6675 Fax: 505-665-4972 Los Alamos National Laboratory P.O. Box 1663 MS D413 Los Alamos, NM 87544 -- Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com http://www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake Bradley Lowekamp Medical Science and Computing for Office of High Performance Computing and Communications National Library of Medicine blowek...@mail.nih.gov mailto:blowek...@mail.nih.gov -- Lori A. Pritchett-Sheats, PhD. CCS-2, Computational Physics and Methods Office: 505-665-6675 Fax: 505-665-4972 Los Alamos National Laboratory P.O. Box 1663 MS D413 Los Alamos, NM 87544 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Running Python unit tests importing modules built in CMake
I'm building Python modules using SWIG and CMake, and have run into a problem running Python unit tests for these built modules. I can not find a slick way to set the Python module search path when running the test. The usual trick of setting sys.path in the scripts will not work here because I don't know the location of the build directory. I've tried updating PYTHONPATH in my CMakeList.txt file but that change isn't picked up when the test is executed. I could create the unit test modules at build time using CONFIGURE_FILE replacing @CMAKE_CURRENT_BINARY_DIR@ in a sys.path line, but that seems heavy-handed. Has anyone else run into this problem and found better a solution? -- Lori A. Pritchett-Sheats, PhD. CCS-2, Computational Physics and Methods Office: 505-665-6675 Fax: 505-665-4972 Los Alamos National Laboratory P.O. Box 1663 MS D413 Los Alamos, NM 87544 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] FindBLAS, FindLAPACK Modules and ACML Errors
I downloaded and installed the latest version of CMake 2.8.8. I found problems with the FindBLAS, FindLAPACK modules. First thing I noticed was the ACML library search does not work for versions 5.0. ACML no longer distributes acml_mv (multivector library) with ACML for versions 5.0. FindBLAS only searches searches for acml and acml_mv libraries. And then I ran into a very strange error with an older version of ACML. Simply calling FindBLAS when I did not set BLAS_ACML_LIB_DIRS, but I did have the ACML install in my LD_LIBRARY_PATH. Output from a very simple foo project that sets BLA_VENDOR to ACML and calls find_package(BLAS) and find_package(LAPACK): -- The C compiler identification is GNU 4.1.2 -- The CXX compiler identification is GNU 4.1.2 -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Error at /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FindBLAS.cmake:294 (list): list index: 0 out of range (-0, 18446744073709551615) Call Stack (most recent call first): CMakeLists.txt:6 (find_package) CMake Error at /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FindBLAS.cmake:295 (list): list index: 0 out of range (-0, 18446744073709551615) Call Stack (most recent call first): CMakeLists.txt:6 (find_package) -- Looking for sgemm_ -- Looking for sgemm_ - found -- A library with BLAS API found. CMake Error at /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FindBLAS.cmake:294 (list): list index: 0 out of range (-0, 18446744073709551615) Call Stack (most recent call first): /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FindLAPACK.cmake:140 (find_package) CMakeLists.txt:7 (find_package) CMake Error at /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FindBLAS.cmake:295 (list): list index: 0 out of range (-0, 18446744073709551615) Call Stack (most recent call first): /opt/packages/cmake/2.8.8/share/cmake-2.8/Modules/FindLAPACK.cmake:140 (find_package) CMakeLists.txt:7 (find_package) -- A library with BLAS API found. -- A library with LAPACK API found. -- BLAS_FOUND=TRUE -- LAPACK_FOUND=TRUE -- BLAS_LIBRARIES=/opt/packages/acml-gnu/4.4.0/gfortran64/lib/libacml.so;/opt/packages/acml-gnu/4.4.0/gfortran64/lib/libacml_mv.so -- LAPACK_LIBRARIES=/opt/packages/acml-gnu/4.4.0/gfortran64/lib/libacml.so;/opt/packages/acml-gnu/4.4.0/gfortran64/lib/libacml_mv.so -- Configuring incomplete, errors occurred! Looking at the source, I believe there is an undefined list variable and a list(GET ...) call that is failing. -- Lori A. Pritchett-Sheats, PhD. CCS-2, Computational Physics and Methods Office: 505-665-6675 Fax: 505-665-4972 Los Alamos National Laboratory P.O. Box 1663 MS D413 Los Alamos, NM 87544 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake