Hello, Would you please critique my CMakeLists.txt and helloConfig.cmake.in files? I am particularly interested in comments that will help me fix these problems:
- In helloConfig.cmake.in, I assume static libraries will be built (".a"). I imaging a better approach would make no assumptions about this. - In helloConfig.cmake.in, I assume ${PREFIX} will expand to the installed prefix, but it does not. - I type the same expression many times: "hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR}". I imagine the better approach would derive this expression from some built-in cmake variables or from a variable I create. - INSTALL is looking for helloConfig.cmake in the source directory but it is in the build directory. - Any other comments you have Thank you! Chris
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(hello) set (hello_VERSION_MAJOR 1) set (hello_VERSION_MINOR 1) ENABLE_TESTING() ADD_LIBRARY(hello hello.cpp) CONFIGURE_FILE(helloConfig.cmake.in helloConfig.cmake) INSTALL( TARGETS hello DESTINATION lib/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR} ) INSTALL( FILES helloConfig.cmake DESTINATION lib/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR} ) INSTALL( FILES hello.h DESTINATION include/hello-${hello_VERSION_MAJOR}.${hello_VERSION_MINOR} )
#include <iostream> void SayHello() { std::cout << "Hello" << std::endl; }
void SayHello();
helloConfig.cmake.in
Description: Binary data
-- 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