mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
SDCC compiler: use sdar instead of sdcclib as librarian for recent versions
Fixes: #19988
This commit is contained in:
6
Help/release/dev/sdcc-new-librarian.rst
Normal file
6
Help/release/dev/sdcc-new-librarian.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
sdcc-new-librarian
|
||||
------------------
|
||||
|
||||
* Since sdcc 3.2.0, sdcclib has been deprecated in favor of sdar as librarian.
|
||||
Since sdcc 3.8.6, it has been removed from the distribution.
|
||||
Use sdar if found, else use sdcclib to keep older compatibility.
|
||||
@@ -19,14 +19,28 @@ set(CMAKE_DL_LIBS "")
|
||||
|
||||
set(CMAKE_C_OUTPUT_EXTENSION ".rel")
|
||||
|
||||
# find sdcclib as CMAKE_AR
|
||||
# since cmake may already have searched for "ar", sdcclib has to
|
||||
# be searched with a different variable name (SDCCLIB_EXECUTABLE)
|
||||
# and must then be forced into the cache
|
||||
# find sdar/sdcclib as CMAKE_AR
|
||||
# since cmake may already have searched for "ar", sdar has to
|
||||
# be searched with a different variable name (SDCCAR_EXECUTABLE)
|
||||
# and must then be forced into the cache.
|
||||
# sdcclib has been deprecated in SDCC 3.2.0 and removed in 3.8.6
|
||||
# so we first look for sdar
|
||||
get_filename_component(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH)
|
||||
find_program(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH)
|
||||
find_program(SDCCLIB_EXECUTABLE sdcclib)
|
||||
set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
|
||||
find_program(SDCCAR_EXECUTABLE sdar NAMES sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH)
|
||||
find_program(SDCCAR_EXECUTABLE sdar NAMES sdcclib)
|
||||
# for compatibility, in case SDCCLIB_EXECUTABLE is set, we use it
|
||||
if(DEFINED SDCCLIB_EXECUTABLE)
|
||||
set(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
|
||||
else()
|
||||
set(CMAKE_AR "${SDCCAR_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE)
|
||||
endif()
|
||||
|
||||
|
||||
if("${SDCCAR_EXECUTABLE}" MATCHES "sdcclib")
|
||||
set(CMAKE_AR_OPTIONS "-a")
|
||||
else()
|
||||
set(CMAKE_AR_OPTIONS "-rc")
|
||||
endif()
|
||||
|
||||
# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file
|
||||
if(NOT DEFINED CMAKE_C_FLAGS_INIT)
|
||||
@@ -45,10 +59,10 @@ set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o
|
||||
# link object files to an executable
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <OBJECTS> -o <TARGET> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
|
||||
|
||||
# needs sdcc 2.7.0 + sddclib from cvs
|
||||
# needs sdcc + sdar/sdcclib
|
||||
set(CMAKE_C_CREATE_STATIC_LIBRARY
|
||||
"\"${CMAKE_COMMAND}\" -E rm -f <TARGET>"
|
||||
"<CMAKE_AR> -a <TARGET> <LINK_FLAGS> <OBJECTS> ")
|
||||
"\"${CMAKE_COMMAND}\" -E remove <TARGET>"
|
||||
"<CMAKE_AR> ${CMAKE_AR_OPTIONS} <TARGET> <LINK_FLAGS> <OBJECTS> ")
|
||||
|
||||
# not supported by sdcc
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "")
|
||||
|
||||
Reference in New Issue
Block a user