Hi, Am new to this mailing list. And have looked at CMake as a tool in a number of other projects including LLVM, but still consider myself a CMake newbie.
I am looking at using CMake for a group of meta language based projects I am developing. Basically I need to be able to develop for all three major C++ compilers, MSVC, GCC, and Clang, on all major platforms, Windows, Linux and on the Mac. What I am wondering is if there is a good starting point / set of scripts for CMake that will allow me to build :- a) On Windows for MSVC, Clang and GCC b) For Linux with Clang/LLVm tool chain and GCC And at some point c) XCode on the Mac Support for using Googles gtest. Basically I don't want to get too bogged down with CMake scripts if it is possible to avoid getting bogged down with them as much as it is possible. Heres where I am now, I have pinched gtests script and have Windows MSVC, MSYS GCC and Linux GCC and Clang. I have used gtest's script as a staring place :- https://github.com/google/googletest/blob/master/googletest/cmake/internal_utils.cmake And the following script :- ~~~ cmake_minimum_required(VERSION 2.6) set(CMAKE_AR /usr/bin/ar CACHE FILEPATH "Archiver") project(gtest-test CXX C) find_package (Threads) # Define helper functions and macros. include(cmake/internal_utils.cmake) config_compiler_and_linker() # Defined in internal_utils.cmake. #message("prefix: ${CMAKE_FIND_LIBRARY_PREFIXES}") #message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}") find_package(BISON) find_package(FLEX) # Locate GTest find_package(GTest REQUIRED) include_directories(${GTEST_INCLUDE_DIRS}) # Link runTests with what we want to test and the GTest and pthread library add_executable(runTests tests.cpp) target_link_libraries(runTests ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) ~~~ It runs fine on Windows with MSVC, seems to be failing on MSYS :- ~~~ $ cmake -G "MSYS Makefiles" . CMake Error: CMAKE_AR was not found, please set to archive program. CMake Error: CMAKE_AR was not found, please set to archive program. CMake Error: CMAKE_AR was not found, please set to archive program. CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) Call Stack (most recent call first): C:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) C:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindGTest.cmake:204 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:20 (find_package) -- Configuring incomplete, errors occurred! See also "C:/Users/Aaron/GitHub/GTest/CMakeFiles/CMakeOutput.log". See also "C:/Users/Aaron/GitHub/GTest/CMakeFiles/CMakeError.log". ~~~ CMakeOutput.txt and CMakeError.txt Files attached. So if theres either a better starting point or better/proper way of doing this then please put me on the right path. Aaron
CMakeError.log
Description: Binary data
CMakeOutput.log
Description: Binary data
-- 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