Название: Помогите с CMake Отправлено: kuzulis от Ноябрь 17, 2009, 10:11 Доброго времени!
Люди, помогите с переходом на CMake под Windows Значит так, создал такую структуру с исходниками: Цитировать /hello |--->/srcapp | |--->main.cpp | |--->CMakeLists.txt (* 2) |--->CMakeLists.txt (* 1) в CMakeLists.txt (* 1) это написал: Цитировать # cmake_minimum_required(VERSION 2.6) project(HELLO CXX) message(STATUS "System: " ${CMAKE_SYSTEM_NAME} " " ${CMAKE_SYSTEM_VERSION}) message(STATUS "Processor: " ${CMAKE_HOST_SYSTEM_PROCESSOR}) if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) if(MSVC) message(STATUS "Compiler: MSVC, version: " ${MSVC_VERSION}) endif(MSVC) if(BORLAND) message(STATUS "Compiler: BCC") endif(BORLAND) if(MINGW) message(STATUS "Compiler: MinGW") endif(MINGW) else(${CMAKE_SYSTEM_NAME} STREQUAL Linux) message(STATUS "Only GCC is supported on Linux") endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) message(STATUS "CMake generates " ${CMAKE_GENERATOR}) find_package(Qt4 REQUIRED) include(${QT_USE_FILE}) add_subdirectory(srcapp) в CMakeLists.txt (* 2) это написал: Цитировать # add_executable (myapp main.cpp) target_link_libraries (myapp ${QT_LIBRARIES}) - далее создал каталог : /hello-build "параллельно" с каталогом /hello - далее вошел в /hello-build - далее сделал : Цитировать D:\projects\cmake_test\hello-build>cmake ../hello CMake Error: CMake was unable to find a build program corresponding to "Visual Studio 6". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: Could not find cmake module file:D:/projects/cmake_test/hello-build/CMakeFiles/CMakeCXXCompiler.cmake -- Configuring incomplete, errors occurred! Помогите написать конфиг для cmake чтобы он автоматом определял и выбирал компилятор MinGW . А то что-то я не понял как. ЗЫ: при создании и изучении сего вопроса я пользовался: http://prog.org.ru/wiki/index.php?title=CMake_%D0%BA%D0%B0%D0%BA_%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0_%D1%81%D0%B1%D0%BE%D1%80%D0%BA%D0%B8_%D0%B4%D0%BB%D1%8F_Qt_%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D0%B9 http://symmetrica.net/cmake/ http://www.cmake.org/cmake/help/examples.html http://www.cmake.org/cmake/help/cmake2.6docs.html#gen:MinGWMakefiles ЗЫЗЫ: и еще подскажите, какие теги нужны для подсветки кода для постинга сюда? Название: Re: Помогите с CMake Отправлено: kuzulis от Ноябрь 17, 2009, 10:54 Предварительно выход нашел с использованием ключа: -G "MinGW Makefiles"
Цитировать D:\projects\cmake_test\hello-build>cmake ../hello -G "MinGW Makefiles" -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: D:/Qt/2009.04/mingw/bin/gcc.exe -- Check for working C compiler: D:/Qt/2009.04/mingw/bin/gcc.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: D:/Qt/2009.04/mingw/bin/g++.exe -- Check for working CXX compiler: D:/Qt/2009.04/mingw/bin/g++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- System: Windows 5.1 -- Processor: x86 -- Compiler: MinGW -- CMake generates MinGW Makefiles -- Looking for Q_WS_X11 -- Looking for Q_WS_X11 - not found. -- Looking for Q_WS_WIN -- Looking for Q_WS_WIN - found -- Looking for Q_WS_QWS -- Looking for Q_WS_QWS - not found. -- Looking for Q_WS_MAC -- Looking for Q_WS_MAC - not found. -- Found Qt-Version 4.5.3 -- Configuring done -- Generating done -- Build files have been written to: D:/projects/cmake_test/hello-build D:\projects\cmake_test\hello-build>make Scanning dependencies of target myapp [100%] Building CXX object srcapp/CMakeFiles/myapp.dir/main.cpp.obj Linking CXX executable myapp.exe [100%] Built target myapp D:\projects\cmake_test\hello-build> но при этом пришлось убрать CXX: Цитировать project(HELLO CXX) т.е. написать просто:Цитировать project(HELLO) иначе в консоль сыпется куча предупреждений и варнингов про расширения файлов *.c . Не понимаю, причем тут *.c . Некорректно парсится конф. файл что-ли.. вот это сыпалось: Цитировать D:\projects\cmake_test\hello-build>cmake ../hello -G "MinGW Makefiles" -- The CXX compiler identification is GNU -- Check for working CXX compiler: D:/Qt/2009.04/mingw/bin/g++.exe -- Check for working CXX compiler: D:/Qt/2009.04/mingw/bin/g++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- System: Windows 5.1 -- Processor: x86 -- Compiler: MinGW -- CMake generates MinGW Makefiles -- Looking for Q_WS_X11 CMake Error: Unknown extension ".c" for file "D:/projects/cmake_test/hello-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c". TRY_COMPILE only works for enabled languages. Currently enabled languages are: CXX See PROJECT command for help enabling other languages. -- Looking for Q_WS_X11 - not found. -- Looking for Q_WS_WIN CMake Error: Unknown extension ".c" for file "D:/projects/cmake_test/hello-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c". TRY_COMPILE only works for enabled languages. Currently enabled languages are: CXX See PROJECT command for help enabling other languages. -- Looking for Q_WS_WIN - not found. -- Looking for Q_WS_QWS CMake Error: Unknown extension ".c" for file "D:/projects/cmake_test/hello-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c". TRY_COMPILE only works for enabled languages. Currently enabled languages are: CXX See PROJECT command for help enabling other languages. -- Looking for Q_WS_QWS - not found. -- Looking for Q_WS_MAC CMake Error: Unknown extension ".c" for file "D:/projects/cmake_test/hello-build/CMakeFiles/CMakeTmp/CheckSymbolExists.c". TRY_COMPILE only works for enabled languages. Currently enabled languages are: CXX See PROJECT command for help enabling other languages. -- Looking for Q_WS_MAC - not found. -- Found Qt-Version 4.5.3 -- Configuring incomplete, errors occurred! |