Reputation: 2695
There is Visual Studio 2015 project. I need to compile it for Debian. I am trying to convert it to makefile using vcxproj2cmake. Firstly I want to compile it on Windows.
perl vcxproj2cmake.pl project1.vcxproj "\Debug|Win32"
generated file
cmake_minimum_required(VERSION 2.8)
## section: Macro
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
IF(MSVC)
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
SET(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch")
SET(Sources ${${SourcesVar}})
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
OBJECT_OUTPUTS "${PrecompiledBinary}")
SET_SOURCE_FILES_PROPERTIES(${Sources}
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
OBJECT_DEPENDS "${PrecompiledBinary}")
# Add precompiled header to SourcesVar
LIST(APPEND ${SourcesVar} ${PrecompiledSource})
ENDIF(MSVC)
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
## start setting
SET (this_target project1)
PROJECT(${this_target})
## section: include directory
INCLUDE_DIRECTORIES(
$(BOOST_INCLUDE)
$(OPENSSL)/include
$(ZLIB_INCLUDE)
./..
)
## section: source files
# Add your source files here (one file per line), please SORT in alphabetical order for future maintenance
SET (${this_target}_SOURCE_FILES
# ...
)
## section: header files
# Add your header files here(one file per line), please SORT in alphabetical order for future maintenance!
SET(${this_target}_HEADER_FILES
# ...
)
## section: precompiled header
#ADD_MSVC_PRECOMPILED_HEADER("precompiled.h" "precompiled.cpp" MySources)
#ADD_LIBRARY(MyLibrary ${MySources})
SET_SOURCE_FILES_PROPERTIES(${this_target}_HEADER_FILES
PROPERTIES HEADER_FILE_ONLY TRUE)
LIST(APPEND ${this_target}_SOURCE_FILES ${${this_target}_HEADER_FILES})
## section: add definitions
# add prefix -D. example> -DSHP
# - DO NOT add the following definitions(already defined in ${OSP_DEFINITIONS}:
# -DSHP, -DWIN32, -D_WINDOWS, -D_DEBUG, -D_USRDLL, -D_CRT_SECURE_NO_DEPRECATE
ADD_DEFINITIONS(
-D_CONSOLE
-DWIN32
-D_PROJECT_1
-DNDEBUG
)
## section: add target
ADD_EXECUTABLE(${this_target} ${${this_target}_SOURCE_FILES})
## section: add dependency
# dependency determines overall build order.
ADD_DEPENDENCIES(${this_target}
ws2_32.lib
zdll.lib
$(BOOST_LIB)/libboost_serialization-vc140-mt-1_61.lib
$(OPENSSL)/lib/libeay32.lib
$(OPENSSL)/lib/ssleay32.lib
)
## section: set link libraries
TARGET_LINK_LIBRARIES( ${this_target}
ws2_32.lib
zdll.lib
$(BOOST_LIB)/libboost_serialization-vc140-mt-1_61.lib
$(OPENSSL)/lib/libeay32.lib
$(OPENSSL)/lib/ssleay32.lib
)
After renaming this file to Makefile1 and entering make -f Makefile-1
I get
Makefile.1:1: *** missing separator. Stop.
What do I have to do?
Upvotes: 0
Views: 2170
Reputation: 668
CMake is a build system that generates code for other build systems (such as make
or VS projects). The tool you used emits CMake code, which must be interpreted by CMake. To build the project (assuming the tool was successful), you can first run CMake with the make
generator, and then run make
on the generated makefile.
Upvotes: 1