Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Commit

Permalink
Misc. CMake config improvements
Browse files Browse the repository at this point in the history
Use standard CMake config directory variable, and don't wipe out
existing flags.
  • Loading branch information
Ortham committed Mar 22, 2016
1 parent 73502c2 commit 1a2f06f
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ project(libespm)
include(ExternalProject)

option(PROJECT_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON)
if (MSVC)
set(BUILD_SUBDIRECTORY $<CONFIGURATION>)
else()
set(BUILD_SUBDIRECTORY "")
endif()

set (Boost_USE_STATIC_LIBS ${PROJECT_STATIC_RUNTIME})
set (Boost_USE_MULTITHREADED ON)
Expand All @@ -25,7 +20,7 @@ ExternalProject_Add(GTest
INSTALL_COMMAND "")
ExternalProject_Get_Property(GTest SOURCE_DIR BINARY_DIR)
set (GTEST_INCLUDE_DIRS "${SOURCE_DIR}/include")
set (GTEST_LIBRARIES "${BINARY_DIR}/${BUILD_SUBDIRECTORY}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}")
set (GTEST_LIBRARIES "${BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}")

ExternalProject_Add(testing-plugins
PREFIX "external"
Expand Down Expand Up @@ -65,12 +60,12 @@ ENDIF ()

# GCC and MinGW settings.
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "-O3 -std=c++11")
set(CMAKE_CXX_FLAGS "-O3 -std=c++11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11")
IF (PROJECT_STATIC_RUNTIME)
set (CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static-libgcc")
set (CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ -static-libgcc")
set (CMAKE_MODULE_LINKER_FLAGS "-static-libstdc++ -static-libgcc")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
ENDIF ()

set(PROJECT_LIBRARIES "pthread")
Expand Down

0 comments on commit 1a2f06f

Please sign in to comment.