在Windows中使用Cygwin我正在尝试构建使用cmake发送给我的C ++项目 经过多次尝试以使其成功构建,并在最后一步出现此错误
fatal: cannot change to '/cygdrive/d/project/C++/project1': No such file or directory
fatal: cannot change to '/cygdrive/d/project/C++/project1/lib/googletest':
主要这个目录d:\project\c++\project1
是我执行的cmake .
的根目录,而gtest库位于同一文件夹中。
我的CMAKELists.txt
cmake_minimum_required(VERSION 3.9)
project(Project1-Solution)
find_package(Threads)
find_package(Git QUIET)
# Set compiler flags
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -pedantic -pedantic-errors -g")
# Make sure we have cloned googletest
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PROJECT_SOURCE_DIR} submodule update --init --recursive)
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PROJECT_SOURCE_DIR}/lib/googletest checkout tags/release-1.8.1)
endif()
# Make sure GTest is built
include(gtest.cmake)
# Include project headers
include_directories(./include)
# Define the source files and dependencies for the executable
set(SOURCE_FILES
src/Handler.cpp
src/AllocationTracker.cpp
tests/main.cpp
tests/HandlerTest.cpp
tests/moreTests.cpp
)
# Make the project root directory the working directory when we run
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
add_executable(testing ${SOURCE_FILES})
add_dependencies(testing gtest)
target_link_libraries(testing gtest ${CMAKE_THREAD_LIBS_INIT})