1.99.9
This commit is contained in:
parent
3e8648a045
commit
e625864248
@ -23,6 +23,7 @@ include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWrapper.cmake)
|
|||||||
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/AddLibrary.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/AddLibrary.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/InstallLibrary.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/InstallLibrary.cmake)
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/Qt5TargetSetup.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/Qt5TargetSetup.cmake)
|
||||||
|
|
||||||
unset(MYX_CMAKE_SOURCE_DIR)
|
unset(MYX_CMAKE_SOURCE_DIR)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
set(MYX_CMAKE_PACKAGE_VERSION "1.99.8")
|
set(MYX_CMAKE_PACKAGE_VERSION "1.99.9")
|
||||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
else()
|
else()
|
||||||
|
@ -11,6 +11,6 @@
|
|||||||
`project` добавить строку:
|
`project` добавить строку:
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
find_package(MyxCMake 1.99.8 PATHS cmake/myx NO_DEFAULT_PATH QUIET REQUIRED)
|
find_package(MyxCMake 1.99.9 PATHS cmake/myx NO_DEFAULT_PATH QUIET REQUIRED)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ include(GenerateExportHeader)
|
|||||||
|
|
||||||
function(myx_add_library NAME)
|
function(myx_add_library NAME)
|
||||||
set(options)
|
set(options)
|
||||||
set(oneValueArgs PCH TYPE)
|
set(oneValueArgs TYPE)
|
||||||
set(multiValueArgs SOURCES LINK_LIBRARIES COMPILE_DEFINITIONS)
|
set(multiValueArgs SOURCES)
|
||||||
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
if(NOT arg_TYPE)
|
if(NOT arg_TYPE)
|
||||||
@ -74,16 +74,4 @@ function(myx_add_library NAME)
|
|||||||
OUTPUT_NAME ${NAME})
|
OUTPUT_NAME ${NAME})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(arg_PCH)
|
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
|
|
||||||
target_precompile_headers(${NAME} PRIVATE ${PROJECT_SOURCE_DIR}/${arg_PCH})
|
|
||||||
else()
|
|
||||||
target_compile_options(${NAME} PRIVATE -include ${PROJECT_SOURCE_DIR}/${arg_PCH})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_sources(${NAME} PRIVATE ${arg_SOURCES} ${PROJECT_SOURCE_DIR}/${arg_PCH})
|
|
||||||
target_compile_definitions(${NAME} PRIVATE ${arg_COMPILE_DEFINITIONS})
|
|
||||||
target_link_libraries(${NAME} PRIVATE ${arg_LINK_LIBRARIES})
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
28
lib/TargetSetup.cmake
Normal file
28
lib/TargetSetup.cmake
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
function(myx_target_setup NAME)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs PCH)
|
||||||
|
set(multiValueArgs COMPILE_DEFINITIONS FIND_PACKAGES LINK_LIBRARIES SOURCES)
|
||||||
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
foreach(iter ${arg_FIND_PACKAGES})
|
||||||
|
find_package(${iter} CONFIG REQUIRED)
|
||||||
|
target_include_directories(${NAME} PRIVATE ${${iter}_INCLUDE_DIRS})
|
||||||
|
target_compile_definitions(${NAME} PRIVATE ${${iter}_COMPILE_DEFINITIONS})
|
||||||
|
endforeach()
|
||||||
|
target_compile_definitions(${NAME} PRIVATE ${arg_COMPILE_DEFINITIONS})
|
||||||
|
|
||||||
|
if(arg_PCH)
|
||||||
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
|
||||||
|
target_precompile_headers(${NAME} PRIVATE ${PROJECT_SOURCE_DIR}/${arg_PCH})
|
||||||
|
else()
|
||||||
|
target_compile_options(${NAME} PRIVATE -include ${PROJECT_SOURCE_DIR}/${arg_PCH})
|
||||||
|
endif()
|
||||||
|
target_sources(${NAME} PRIVATE ${PROJECT_SOURCE_DIR}/${arg_PCH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_sources(${NAME} PRIVATE ${arg_SOURCES})
|
||||||
|
target_link_libraries(${NAME} PRIVATE ${arg_LINK_LIBRARIES})
|
||||||
|
target_compile_definitions(${NAME} PRIVATE ${arg_COMPILE_DEFINITIONS})
|
||||||
|
endfunction()
|
Loading…
Reference in New Issue
Block a user