File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -52,16 +52,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
5252set (CMAKE_CXX_EXTENSIONS OFF )
5353
5454set (configure_warnings)
55- if (CMAKE_VERSION  VERSION_GREATER_EQUAL  3.14)
56-   include (CheckPIESupported)
57-   check_pie_supported(OUTPUT_VARIABLE  check_pie_output LANGUAGES CXX)
58-   if (NOT  CMAKE_CXX_LINK_PIE_SUPPORTED)
59-     list (APPEND  configure_warnings "PIE link options are not supported for executable targets: ${check_pie_output} ." )
60-   endif ()
61- else ()
62-   list (APPEND  configure_warnings "No PIE options will be passed to a linker for executable targets." )
63- endif ()
64- set (CMAKE_POSITION_INDEPENDENT_CODE  ON )
6555
6656if (WIN32 )
6757  #[=[ 
@@ -123,6 +113,19 @@ include(cmake/secp256k1.cmake)
123113include (CheckStdFilesystem)
124114check_std_filesystem()
125115
116+ if (CMAKE_VERSION  VERSION_GREATER_EQUAL  3.14)
117+   include (CheckPIESupported)
118+   check_pie_supported(OUTPUT_VARIABLE  check_pie_output LANGUAGES CXX)
119+   if (CMAKE_CXX_LINK_PIE_SUPPORTED)
120+     set (CMAKE_POSITION_INDEPENDENT_CODE  ON )
121+   endif ()
122+ else ()
123+   check_cxx_source_links_with_flags(-fPIE "int main(){}"  COMPILER_SUPPORTS_PIE)
124+   if (COMPILER_SUPPORTS_PIE)
125+     set (CMAKE_POSITION_INDEPENDENT_CODE  ON )
126+   endif ()
127+ endif ()
128+ 
126129add_subdirectory (src)
127130
128131message ("\n " )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments