mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	cmake: Use CMAKE_SHARED_LIBRARY_C_FLAGS in version script checks
Building the version script test executable may fail in the link step with GNU ld as linker like this: ld: final link failed: Nonrepresentable section on output Building the test excutable with CMAKE_SHARED_LIBRARY_C_FLAGS makes the test succeed with GNU ld since this adds -fpic/-fPIC. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This commit is contained in:
		
							parent
							
								
									cd0ea2a7f5
								
							
						
					
					
						commit
						aeb26da4cb
					
				| @ -21,6 +21,7 @@ | |||||||
| # Revised by Christopher Sean Morrison, 2022 | # Revised by Christopher Sean Morrison, 2022 | ||||||
| # Revised by Martin Storsjo, 2022 | # Revised by Martin Storsjo, 2022 | ||||||
| # Revised by Jon Creighton, 2023 | # Revised by Jon Creighton, 2023 | ||||||
|  | # Revised by Gunther Nikl, 2023 | ||||||
| 
 | 
 | ||||||
| # This code is released under the libpng license. | # This code is released under the libpng license. | ||||||
| # For conditions of distribution and use, see the disclaimer | # For conditions of distribution and use, see the disclaimer | ||||||
| @ -243,13 +244,19 @@ VERS_2 { | |||||||
| } VERS_1; | } VERS_1; | ||||||
| ") | ") | ||||||
|   set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) |   set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) | ||||||
|   set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'") |   set(CMAKE_REQUIRED_FLAGS | ||||||
|  |       ${CMAKE_REQUIRED_FLAGS} | ||||||
|  |       ${CMAKE_SHARED_LIBRARY_C_FLAGS} | ||||||
|  |       "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'") | ||||||
|   check_c_source_compiles("void sym(void) {} |   check_c_source_compiles("void sym(void) {} | ||||||
| void sym2(void) {} | void sym2(void) {} | ||||||
| int main(void) {return 0;} | int main(void) {return 0;} | ||||||
| " HAVE_LD_VERSION_SCRIPT) | " HAVE_LD_VERSION_SCRIPT) | ||||||
|   if(NOT HAVE_LD_VERSION_SCRIPT) |   if(NOT HAVE_LD_VERSION_SCRIPT) | ||||||
|     set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") |     set(CMAKE_REQUIRED_FLAGS | ||||||
|  |         ${CMAKE_REQUIRED_FLAGS_SAVE} | ||||||
|  |         ${CMAKE_SHARED_LIBRARY_C_FLAGS} | ||||||
|  |         "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") | ||||||
|   check_c_source_compiles("void sym(void) {} |   check_c_source_compiles("void sym(void) {} | ||||||
| void sym2(void) {} | void sym2(void) {} | ||||||
| int main(void) {return 0;} | int main(void) {return 0;} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Gunther Nikl
						Gunther Nikl