1
0

CMake: Fixed output paths for all MSVC versions.

This commit is contained in:
madmaxoft 2014-01-16 18:33:28 +01:00
parent e29749b35e
commit dab37db562
2 changed files with 19 additions and 11 deletions

View File

@ -22,11 +22,17 @@ endif()
if (WIN32)
add_library(lua SHARED ${SOURCE})
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)
if (MSVC)
# MSVC generator adds a "Debug" or "Release" postfixes to the LIBRARY_OUTPUT_PATH, we need to cancel them:
SET_TARGET_PROPERTIES(lua PROPERTIES PREFIX "../")
SET_TARGET_PROPERTIES(lua PROPERTIES IMPORT_PREFIX "../")
# Output the executable into the $/MCServer folder, so that MCServer can find it:
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/MCServer
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/MCServer
RUNTIME_OUTPUT_DIRECTORY_DEBUGPROFILE ${CMAKE_SOURCE_DIR}/MCServer
RUNTIME_OUTPUT_DIRECTORY_RELEASEPROFILE ${CMAKE_SOURCE_DIR}/MCServer
)
if (MSVC)
# Remove SCL warnings, we expect this library to have been tested safe
SET_TARGET_PROPERTIES(
lua PROPERTIES COMPILE_FLAGS "-D_CRT_SECURE_NO_WARNINGS"

View File

@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 2.8.2)
project (MCServer)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@ -88,13 +88,15 @@ set(EXECUTABLE MCServer)
add_executable(${EXECUTABLE} ${SOURCE})
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)
if (MSVC)
# MSVC generator adds a "Debug" or "Release" postfixes to the EXECUTABLE_OUTPUT_PATH, we need to cancel them:
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES PREFIX "../")
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES IMPORT_PREFIX "../")
endif()
# Output the executable into the $/MCServer folder, so that it has access to external resources:
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/MCServer
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/MCServer
RUNTIME_OUTPUT_DIRECTORY_DEBUGPROFILE ${CMAKE_SOURCE_DIR}/MCServer
RUNTIME_OUTPUT_DIRECTORY_RELEASEPROFILE ${CMAKE_SOURCE_DIR}/MCServer
)
# Make the debug executable have a "_debug" suffix