프로젝트의 빌드 시스템을 CMake로 바꾸려고하는데 CMake를 사용하여 개체 파일을 만들 수 없습니다.CMake는 개체 파일을 만들지 못하며 연결에 실패합니다.
프로젝트 나무는 다음과 같이이다 :
CMakeLists.txt
psg-play.c
psg/
CMakeLists.txt
psg.h
psg-constants.h
psg.c
(12 개) 솔루션은 오류로 연결하는 데 실패 생성 된 비주얼 스튜디오 다음 PSG 빌드 디렉토리에
LINK : fatal error LNK1181: cannot open input file 'psg\Release\psg.obj'
(PSG의 \ 출시)가 확장자가없는 'psg'라는 단일 파일.
CMakeLists 파일은 다음과 같습니다. (메인 CMakeLists.txt)
# Main
cmake_minimum_required (VERSION 2.8)
#Add all the dependencies
include_directories ("${PROJECT_SOURCE_DIR}/psg")
add_subdirectory (psg)
# --- The project executables ---
project (psgp)
# --- psg-play
add_executable (psg-play psg-play.c)
target_link_libraries (psg-play psg)
PSG/CMakeLists.txt
add_library(psg psg.c)
가 어떻게 제대로 컴파일 및 링 두 파일?
감사합니다! 나는 라이브러리의 CMakeLists에서 그 라인을 가지지 않는 * CMake 튜토리얼을 따라 가고 있었다. – NeonMan
라이브러리가 더 큰 프로젝트의 일부라면 그것은 프로젝트()를 가지지 않을 것이다. 루트 프로젝트에 CMakeList.txt 라이브러리가 포함되어있는 경우 CMakeLists.txt 라이브러리에 루트 CMakeLists.txt 만 프로젝트()가 없어야합니다. – drescherjm