mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-18 04:54:36 +03:00
Updated minimum cmake version to 3.19
* The latest cmake versions started showing warnings about the
minimum version supported as there are possibly some breaking
changes not affecting us
* Reworked some bits in CMakeLists.txt to take advantage of the
raised version
* Removed the use of policies that are now enabled by cmake by
default
* Removed deprecated build options
This commit is contained in:
@@ -1,38 +1,16 @@
|
|||||||
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
|
||||||
|
|
||||||
cmake_policy(PUSH)
|
# Don't create a project if it was already created by another CMakeLists.txt. This makes
|
||||||
|
# it possible to support both add_subdirectory() and include() ways of using AsmJit as a
|
||||||
if (POLICY CMP0063)
|
# dependency.
|
||||||
cmake_policy(SET CMP0063 NEW) # Honor visibility properties.
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (POLICY CMP0092)
|
|
||||||
cmake_policy(SET CMP0092 NEW) # Don't add -W3 warning level by default.
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Don't create a project if it was already created by another CMakeLists.txt.
|
|
||||||
# This allows one library to embed another library without making a collision.
|
|
||||||
if (NOT CMAKE_PROJECT_NAME OR "${CMAKE_PROJECT_NAME}" STREQUAL "asmjit")
|
if (NOT CMAKE_PROJECT_NAME OR "${CMAKE_PROJECT_NAME}" STREQUAL "asmjit")
|
||||||
project(asmjit CXX)
|
project(asmjit CXX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
INCLUDE(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# AsmJit - Deprecated
|
|
||||||
# ===================
|
|
||||||
|
|
||||||
if (DEFINED ASMJIT_BUILD_EMBED)
|
|
||||||
message(DEPRECATION "ASMJIT_BUILD_EMBED is deprecated, use ASMJIT_EMBED")
|
|
||||||
set(ASMJIT_EMBED "${ASMJIT_BUILD_EMBED}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (DEFINED ASMJIT_BUILD_STATIC)
|
|
||||||
message(DEPRECATION "ASMJIT_BUILD_STATIC is deprecated, use ASMJIT_STATIC")
|
|
||||||
set(ASMJIT_STATIC "${ASMJIT_BUILD_STATIC}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# AsmJit - Configuration - Build
|
# AsmJit - Configuration - Build
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
||||||
@@ -212,18 +190,14 @@ function(asmjit_add_target target target_type)
|
|||||||
add_library(${target} ${target_type} ${X_SOURCES})
|
add_library(${target} ${target_type} ${X_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL "")
|
set_target_properties(${target}
|
||||||
target_link_libraries(${target} PRIVATE ${X_LIBRARIES})
|
PROPERTIES
|
||||||
|
DEFINE_SYMBOL ""
|
||||||
# target_link_options was added in cmake v3.13, don't use it for now...
|
CXX_VISIBILITY_PRESET hidden)
|
||||||
foreach(link_flag ${ASMJIT_PRIVATE_LFLAGS})
|
|
||||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${link_flag}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
target_compile_features(${target} PUBLIC cxx_std_11)
|
|
||||||
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS NO)
|
|
||||||
set_property(TARGET ${target} PROPERTY CXX_VISIBILITY_PRESET hidden)
|
|
||||||
target_compile_options(${target} PRIVATE ${X_CFLAGS} ${ASMJIT_SANITIZE_CFLAGS} $<$<CONFIG:Debug>:${X_CFLAGS_DBG}> $<$<NOT:$<CONFIG:Debug>>:${X_CFLAGS_REL}>)
|
target_compile_options(${target} PRIVATE ${X_CFLAGS} ${ASMJIT_SANITIZE_CFLAGS} $<$<CONFIG:Debug>:${X_CFLAGS_DBG}> $<$<NOT:$<CONFIG:Debug>>:${X_CFLAGS_REL}>)
|
||||||
|
target_compile_features(${target} PUBLIC cxx_std_11)
|
||||||
|
target_link_options(${target} PRIVATE ${ASMJIT_PRIVATE_LFLAGS})
|
||||||
|
target_link_libraries(${target} PRIVATE ${X_LIBRARIES})
|
||||||
|
|
||||||
if ("${target_type}" STREQUAL "TEST")
|
if ("${target_type}" STREQUAL "TEST")
|
||||||
add_test(NAME ${target} COMMAND ${target})
|
add_test(NAME ${target} COMMAND ${target})
|
||||||
@@ -590,10 +564,8 @@ if (NOT ASMJIT_EMBED)
|
|||||||
$<BUILD_INTERFACE:${ASMJIT_INCLUDE_DIRS}>
|
$<BUILD_INTERFACE:${ASMJIT_INCLUDE_DIRS}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
|
|
||||||
# Add asmjit::asmjit alias.
|
# Create an asmjit::asmjit alias.
|
||||||
add_library(asmjit::asmjit ALIAS asmjit)
|
add_library(asmjit::asmjit ALIAS asmjit)
|
||||||
# TODO: [CMAKE] Deprecated alias - we use projectname::libraryname convention now.
|
|
||||||
add_library(AsmJit::AsmJit ALIAS asmjit)
|
|
||||||
|
|
||||||
# Add AsmJit install instructions (library and public headers).
|
# Add AsmJit install instructions (library and public headers).
|
||||||
if (NOT ASMJIT_NO_INSTALL)
|
if (NOT ASMJIT_NO_INSTALL)
|
||||||
@@ -713,5 +685,3 @@ if (NOT ASMJIT_EMBED)
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_policy(POP)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user