Hello,
coming from scons I want to take a look into cmake...
My CMakeList.txt looks like:
cmake_minimum_required (VERSION 3.0)
project (ASTE)
add_executable(readMesh readMesh.cpp)
find_library(precice precice PATHS $ENV{PRECICE_ROOT}/build/last)
target_link_libraries(readMesh ${precice})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} $ENV{PRECICE_ROOT}/build/last)
find_package(Boost 1.60.0
COMPONENTS program_options filesystem
REQUIRED)
target_link_libraries(readMesh ${Boost_LIBRARIES})
find_package(MPI REQUIRED)
target_link_libraries(readMesh ${MPI_LIBRARIES})
set(COMPILE_FLAGS ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS})
and does it job, i.e. the target builds. precice is out own, independently
build library.
However, I have several questions:
* Can I make target_link_libraries add a library for all defined targets? At
the moment, there is only one, but in the
projekt there are multiple, very similiar targets built.
* Can I make find_library to treat the library as required, as with
find_package?
* Can I reused the value of find_library's PATH setting? Especially if there
are multiple PATHs, wouldn't it be nice to
have a precice-LIBPATH that contains the path, where the library was found? So
I can add this to CMAKE_LIBRARY_PATH? Or
is there another function that does all that?
* Is there a way to clean cmake cache, other than rm -rf CMakeFiles
CMakeCache.txt. Would be nice, when playing around
and frequently changing the CMakeLists.txt
* I am a bit suprised that finding/or not finding MPI or precice is not printed
out when executing cmake.
* Any other advises you want to give me?
Thanks for helping a beginner!
Florian
--
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