File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ project(runtime)
22
33cmake_minimum_required (VERSION  2.8.9)
44
5+ include (CheckIncludeFile)
6+ 
57# Verify required variables if this CMake project is NOT embedded in the LDC CMake project. 
68if (NOT  LDC_EXE)
79    if (NOT  LDC_EXE_FULL)
@@ -296,7 +298,7 @@ foreach(target ${LLVM_TARGETS_TO_BUILD})
296298endforeach ()
297299
298300# Always build zlib and other C parts of the runtime in release mode, regardless 
299- # of what the user chose for LDC itself. 
301+ # of what the user chose for LDC itself. Also add other C_FLAGS here.  
300302# 1) Set up CMAKE_C_FLAGS_RELEASE 
301303if ("${TARGET_SYSTEM} "  MATCHES  "MSVC" )
302304    # Omit all references to the default C runtime libs. 
@@ -308,6 +310,11 @@ if("${TARGET_SYSTEM}" MATCHES "MSVC")
308310    # warning C4996: zlib uses 'deprecated' POSIX names 
309311    append ("/wd4131 /wd4206 /wd4996"  CMAKE_C_FLAGS_RELEASE)
310312endif ()
313+ CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
314+ if  (HAVE_UNISTD_H)
315+     # Needed for zlib 
316+     append ("-DHAVE_UNISTD_H"  CMAKE_C_FLAGS_RELEASE)
317+ endif ()
311318# 2) Set all other CMAKE_C_FLAGS variants to CMAKE_C_FLAGS_RELEASE 
312319set (variables 
313320    CMAKE_C_FLAGS_DEBUG
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments