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_guard(DIRECTORY)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
macro(setup_project name dir)
|
macro(setup_base type name dir)
|
||||||
project(
|
project(
|
||||||
${name}
|
${name}
|
||||||
)
|
)
|
||||||
|
|
@ -12,15 +12,29 @@ macro(setup_project name dir)
|
||||||
*.c
|
*.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(${type} STREQUAL "project")
|
||||||
add_executable(
|
add_executable(
|
||||||
${name}
|
${name}
|
||||||
${${name}_SRC}
|
${${name}_SRC}
|
||||||
)
|
)
|
||||||
|
elseif(${type} STREQUAL "library")
|
||||||
|
add_library(
|
||||||
|
${name}
|
||||||
|
${${name}_SRC}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT ${name} STREQUAL "MDECore")
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
${name}
|
${name}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
MDECore Mw
|
MDECore
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(
|
||||||
|
${name}
|
||||||
|
PRIVATE
|
||||||
|
Mw
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
|
|
@ -29,6 +43,24 @@ macro(setup_project name dir)
|
||||||
)
|
)
|
||||||
endmacro()
|
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)
|
macro(math_add name)
|
||||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue