diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-04-14 18:37:13 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-04-14 18:37:13 +0300 |
commit | cfecdac66f1bde8da28adf34d782cfff6be9f83e (patch) | |
tree | 2ab09485919821bd365639acccc69e21b93219e2 /cmake/Platform | |
parent | ce58885c11947bc4fb511646989c7d88212f69fa (diff) |
Store CMAKE_AR and CMAKE_RANLIB in CMake CACHE so that the values persist to user CMake toolchain files. Also CACHE the variable Emscripten, in the hope of that fixing the visibility issue with variable. Some users have reported that in their CMakeLists.txt files the variable EMSCRIPTEN is not always visible, even though in the Emscripten cmake unit tests it always works. Fixes #2288. Thanks mhenschel!
Diffstat (limited to 'cmake/Platform')
-rw-r--r-- | cmake/Platform/Emscripten.cmake | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cmake/Platform/Emscripten.cmake b/cmake/Platform/Emscripten.cmake index 7d86c467..f9d8c773 100644 --- a/cmake/Platform/Emscripten.cmake +++ b/cmake/Platform/Emscripten.cmake @@ -66,11 +66,11 @@ if ("${CMAKE_CXX_COMPILER}" STREQUAL "") endif() if ("${CMAKE_AR}" STREQUAL "") - set(CMAKE_AR "${EMSCRIPTEN_ROOT_PATH}/emar${EMCC_SUFFIX}") + set(CMAKE_AR "${EMSCRIPTEN_ROOT_PATH}/emar${EMCC_SUFFIX}" CACHE FILEPATH "Emscripten ar") endif() if ("${CMAKE_RANLIB}" STREQUAL "") - set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib${EMCC_SUFFIX}") + set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib${EMCC_SUFFIX}" CACHE FILEPATH "Emscripten ranlib") endif() # Don't do compiler autodetection, since we are cross-compiling. @@ -113,8 +113,7 @@ set(CMAKE_CXX_ARCHIVE_APPEND "${CMAKE_AR} r <TARGET> ${CMAKE_START_TEMP_FILE} <L set(CMAKE_C_ARCHIVE_APPEND "${CMAKE_AR} r <TARGET> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <OBJECTS>${CMAKE_END_TEMP_FILE}") # Set a global EMSCRIPTEN variable that can be used in client CMakeLists.txt to detect when building using Emscripten. -# There seems to be some kind of bug with CMake, so you might need to define this manually on the command line with "-DEMSCRIPTEN=1". -set(EMSCRIPTEN 1) +set(EMSCRIPTEN 1 CACHE BOOL "If true, we are targeting Emscripten output.") # We are cross-compiling, so unset the common CMake variables that represent the target platform. Leave UNIX define enabled, since Emscripten # mimics a Linux environment. |