CMake error: CMake cannot determine linker language for target: myapp

I am trying to compile vMime using cmake, but I get the error above, I use the cmake GUI, and my makefiles.txt below. It is configured correctly, but does not generate

cmake_minimum_required(VERSION 2.8)
PROJECT(CXX)#vmime
enable_language(CXX)
set(VerifyCXX VerifyCXX.cxx)
add_definitions(-DVERIFY_CXX)
set_target_properties(${TARGET} PROPERTIES LINKER_LANGUAGE Cxx)
add_executable(myapp vmime)
install(TARGETS myapp DESTINATION bin)

Help would be greatly appreciated as I was stuck at a point for a couple of days.

+4
source share
4 answers
cmake_minimum_required(VERSION 2.8)
project(vmime)
add_executable(vmime VerifyCXX.cxx)

You may need to add definitions and install, but this should be enough for you to start, assuming you have the VerifyCXX.cxx file - under Linux file names are case sensitive.

+2
source

CMake, , myapp, .

add_executable(myapp vmime)

add_executable(myapp ${VerifyCXX})

set_target_properties(${TARGET} PROPERTIES LINKER_LANGUAGE Cxx) 

, ${TARGET} . add_executable

set_target_properties(myapp PROPERTIES LINKER_LANGUAGE CXX)

, .

+6

, , , :

Cannot find source file:

    MyFirstSourceFile.cpp

CMake : " CMake: CMake : myapp", - , .

: CMakeLists.txt. , " "!

+2

I am using a clion IDE based on cmake, my source files are named * .cc

project(server)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
file(GLOB SRC_FILE "main.cc" "listenfd.cc" "socket_util.cc"
    "timers.cc" "network.cc" "main_event.cc")
add_executable(server ${server})
set_target_properties(server PROPERTIES LINKER_LANGUAGE CXX)

after change

add_executable(server ${server}) to 
add_executable(server "main.cc")

then I solved it, I really don’t know why? after the experiment, I found that when a file is used (GLOB ....), similar to the file (GLOB "src / main.cc"), I must specify the relative path, then it works.

0
source

All Articles