cmake
This commit is contained in:
parent
036f6ddbc9
commit
85f5e0aa5f
1 changed files with 38 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
include_guard(DIRECTORY)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
macro(setup_project name dir)
|
||||
macro(setup_base type name dir)
|
||||
project(
|
||||
${name}
|
||||
)
|
||||
|
|
@ -12,15 +12,29 @@ macro(setup_project name dir)
|
|||
*.c
|
||||
)
|
||||
|
||||
add_executable(
|
||||
${name}
|
||||
${${name}_SRC}
|
||||
)
|
||||
if(${type} STREQUAL "project")
|
||||
add_executable(
|
||||
${name}
|
||||
${${name}_SRC}
|
||||
)
|
||||
elseif(${type} STREQUAL "library")
|
||||
add_library(
|
||||
${name}
|
||||
${${name}_SRC}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT ${name} STREQUAL "MDECore")
|
||||
target_link_libraries(
|
||||
${name}
|
||||
PRIVATE
|
||||
MDECore
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(
|
||||
${name}
|
||||
PRIVATE
|
||||
MDECore Mw
|
||||
Mw
|
||||
)
|
||||
|
||||
install(
|
||||
|
|
@ -29,6 +43,24 @@ macro(setup_project name dir)
|
|||
)
|
||||
endmacro()
|
||||
|
||||
macro(setup_project name dir)
|
||||
setup_base(project ${name} ${dir})
|
||||
endmacro()
|
||||
|
||||
macro(setup_library name)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
setup_base(library ${name} ${CMAKE_INSTALL_LIBDIR}/${dir})
|
||||
|
||||
if(EXISTS "../include")
|
||||
target_include_directories(
|
||||
${name}
|
||||
PUBLIC
|
||||
../include
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(math_add name)
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_link_libraries(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue