Hacker News new | ask | show | jobs
by Poyeyo 3908 days ago
I think I agree with you on all fronts, simply because the online cmake documentation is not as good as it should be.

For BLAS, it has a

    find_package ( BLAS )
script, which you can use. The same for CUDA. They define cmake variables you can use later for the include and link search paths.

https://cmake.org/cmake/help/v3.0/module/FindBLAS.html

https://cmake.org/cmake/help/v3.0/module/FindCUDA.html

I haven't used C11 or Fortran95, only C++11, and I had to add a cmake script for it, you can find it as CheckCXXCompilerFlag somewhere in the web.

I have to use Visual Studio instead of mingw because I'm using some winSDK libs, and VS has no (gnu)make, and what VS offers for the command line is not cross-platform, making it a poor investment of my time to learn about it.

After climbing just a section of the the steep cmake learning curve, I have deleted the solution and project files from my repository, and now I use cmake to compile and run the project in the command line with both VS2008 in Win7 (the PC) and VS2012 in Win8.1 (the laptop), without any path dependency. Previously the solution files depended on both my username and the path, and just moving the folder was cumbersome and required a lot of fiddling with those files.

Another thing I really like is the concept of an out of source build, and that's very easy to set up and use with cmake.

I now can write

    git clone somewhere:my_project.git
    cd my_project
    mkdir build && cd build
    cmake -DCMAKE_INSTALL_PREFIX:PATH=../install ..
    cmake --build . --target install && cmake --build . --target run
in both Ubuntu and Windows and see my program running, which means I will not go back to make, or nmake or gmake anytime soon.