commit 40f19e7d17acd8c70de5bc1c4088f5e04312df32 parent 1453e697b23ab942ed54688803522472d4ff5d69 Author: [email protected] <[email protected]> Date: Fri, 1 Jul 2016 14:43:00 +0300 Updated CMakeLists.txt Diffstat:
M | CMakeLists.txt | | | 26 | ++++++++++++++++---------- |
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -17,18 +17,24 @@ cmake_minimum_required(VERSION 3.0) +set(OPT_BITNESS "") # cmake -DOPT_BITNESS="-m32" or -m64 +set(OPT_STATIC "") # cmake -DOPT_STATIC="-static" + +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_C_COMPILER clang) +if (CMAKE_BUILD_TYPE_INITIALIZED_TO_DEFAULT) + set(CMAKE_BUILD_TYPE Release) +endif () if (${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles" OR ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles") - if (CMAKE_BUILD_TYPE_INITIALIZED_TO_DEFAULT) - set(CMAKE_BUILD_TYPE Release) - endif () - set(CMAKE_CXX_COMPILER clang++) - set(CMAKE_C_COMPILER clang) - set(CMAKE_CXX_FLAGS --target=x86_64-w64-windows-gnu CACHE STRING "compile flags" FORCE) - set(CMAKE_C_FLAGS --target=x86_64-w64-windows-gnu CACHE STRING "compile flags" FORCE) - set(CMAKE_EXE_LINKER_FLAGS --target=x86_64-w64-windows-gnu) - set(CMAKE_SHARED_LINKER_FLAGS --target=x86_64-w64-windows-gnu) - set(CMAKE_STATIC_LINKER_FLAGS --target=x86_64-w64-windows-gnu) + set(OPT_TARGET "--target=x86_64-w64-windows-gnu") +else () + set(OPT_TARGET "") # default target endif () +set(CMAKE_CXX_FLAGS "${OPT_TARGET} ${OPT_BITNESS} ${OPT_STATIC}" CACHE STRING "compile flags" FORCE) +set(CMAKE_C_FLAGS "${OPT_TARGET} ${OPT_BITNESS} ${OPT_STATIC}" CACHE STRING "compile flags" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "${OPT_TARGET} ${OPT_BITNESS}") +set(CMAKE_SHARED_LINKER_FLAGS "${OPT_TARGET} ${OPT_BITNESS}") +set(CMAKE_STATIC_LINKER_FLAGS "${OPT_TARGET} ${OPT_BITNESS}") project(kfr)