mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Fix a build regression on Solaris
Fix a regression introduced in commit aeb26da4cb64c0e75c8d.
On an Illumos test machine, running the GCC compiler and the Solaris
link editor, the CMake build failed with the following error:
ld: fatal: unrecognized option '--version-script=/.../libpng.vers'
The fix consists in avoiding the use of CMAKE_SHARED_LIBRARY_C_FLAGS
in version script checks on Solaris.
Also clean up the surrounding code, as follows:
* Rename CMAKE_REQUIRED_FLAGS_SAVE to _SAVED_CMAKE_REQUIRED_FLAGS.
(The name of an internal variable should not begin with "CMAKE_".)
* Reformat the version script to optimize the vertical space.
This commit is contained in:
parent
e6c5bf46c4
commit
afc6c595bf
@ -240,38 +240,36 @@ option(ld-version-script "Enable linker version script" ON)
|
|||||||
if(ld-version-script AND NOT ANDROID AND NOT APPLE)
|
if(ld-version-script AND NOT ANDROID AND NOT APPLE)
|
||||||
# Check if LD supports linker scripts.
|
# Check if LD supports linker scripts.
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "
|
||||||
VERS_1 {
|
VERS_1 { global: sym1; local: *; };
|
||||||
global: sym1;
|
VERS_2 { global: sym2; main; } VERS_1;
|
||||||
local: *;
|
|
||||||
};
|
|
||||||
|
|
||||||
VERS_2 {
|
|
||||||
global: sym2;
|
|
||||||
main;
|
|
||||||
} VERS_1;
|
|
||||||
")
|
")
|
||||||
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
|
set(_SAVED_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
set(CMAKE_REQUIRED_FLAGS
|
if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "^SunOS")
|
||||||
${CMAKE_REQUIRED_FLAGS}
|
# Avoid using CMAKE_SHARED_LIBRARY_C_FLAGS in version script checks on
|
||||||
${CMAKE_SHARED_LIBRARY_C_FLAGS}
|
# Solaris, because of an incompatibility with the Solaris link editor.
|
||||||
"-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
|
list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
|
||||||
|
endif()
|
||||||
|
list(APPEND CMAKE_REQUIRED_FLAGS "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
void sym1(void) {}
|
void sym1(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
|
set(CMAKE_REQUIRED_FLAGS ${_SAVED_CMAKE_REQUIRED_FLAGS})
|
||||||
${CMAKE_REQUIRED_FLAGS_SAVE}
|
if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "^SunOS")
|
||||||
${CMAKE_SHARED_LIBRARY_C_FLAGS}
|
# Again, avoid using CMAKE_SHARED_LIBRARY_C_FLAGS in version script
|
||||||
"-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
# checks on Solaris.
|
||||||
check_c_source_compiles("
|
list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
|
||||||
|
endif()
|
||||||
|
list(APPEND CMAKE_REQUIRED_FLAGS "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
check_c_source_compiles("
|
||||||
void sym1(void) {}
|
void sym1(void) {}
|
||||||
void sym2(void) {}
|
void sym2(void) {}
|
||||||
int main(void) {return 0;}
|
int main(void) { return 0; }
|
||||||
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
|
set(CMAKE_REQUIRED_FLAGS ${_SAVED_CMAKE_REQUIRED_FLAGS})
|
||||||
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user