Skip to content

Commit de12f85

Browse files
authored
Fix Emscripten build of libraries (dotnet#762)
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.
1 parent 3d4ee62 commit de12f85

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/libraries/Native/Unix/CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
cmake_minimum_required(VERSION 2.8.12)
22
project(CoreFX C)
33

4-
cmake_policy(SET CMP0083 NEW)
4+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Emscripten)
5+
cmake_policy(SET CMP0083 NEW)
56

6-
include(CheckPIESupported)
7+
include(CheckPIESupported)
78

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

1618
set(CMAKE_MACOSX_RPATH ON)
1719
set(CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir})

0 commit comments

Comments
 (0)