Skip to content

Commit

Permalink
Fix Emscripten build of libraries (#762)
Browse files Browse the repository at this point in the history
Updating the libraries native build to use native cmake support for the
position independent code has broken emscripten build. This change
disables that for Emscripten.
  • Loading branch information
janvorli authored Dec 11, 2019
1 parent 3d4ee62 commit de12f85
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/libraries/Native/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
cmake_minimum_required(VERSION 2.8.12)
project(CoreFX C)

cmake_policy(SET CMP0083 NEW)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Emscripten)
cmake_policy(SET CMP0083 NEW)

include(CheckPIESupported)
include(CheckPIESupported)

# All code we build should be compiled as position independent
check_pie_supported(OUTPUT_VARIABLE PIE_SUPPORT_OUTPUT LANGUAGES C)
if(NOT MSVC AND NOT CMAKE_C_LINK_PIE_SUPPORTED)
message(WARNING "PIE is not supported at link time: ${PIE_SUPPORT_OUTPUT}.\n"
"PIE link options will not be passed to linker.")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# All code we build should be compiled as position independent
check_pie_supported(OUTPUT_VARIABLE PIE_SUPPORT_OUTPUT LANGUAGES C)
if(NOT MSVC AND NOT CMAKE_C_LINK_PIE_SUPPORTED)
message(WARNING "PIE is not supported at link time: ${PIE_SUPPORT_OUTPUT}.\n"
"PIE link options will not be passed to linker.")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif(NOT CMAKE_SYSTEM_NAME STREQUAL Emscripten)

set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir})
Expand Down

0 comments on commit de12f85

Please sign in to comment.