mirror of
https://github.com/hmaxnl/based.git
synced 2025-01-18 09:24:20 +01:00
Configuring CMake, project structure
This commit is contained in:
parent
d262af06a6
commit
a60a14b6b6
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -72,6 +72,10 @@ lib/
|
||||||
LIB/
|
LIB/
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
[Tt]est/
|
||||||
|
[Tt]ests/
|
||||||
|
|
||||||
# IDE
|
# IDE
|
||||||
.vs/
|
.vs/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
|
@ -7,8 +7,10 @@ project("Based" LANGUAGES C ASM)
|
||||||
# =============================================
|
# =============================================
|
||||||
#unset(DOCUMENTATION CACHE)
|
#unset(DOCUMENTATION CACHE)
|
||||||
#unset(INTERNAL_DOC, CACHE)
|
#unset(INTERNAL_DOC, CACHE)
|
||||||
|
#unset(BUILD_EXAMPLES, CACHE)
|
||||||
option(DOCUMENTATION "Enable to generate ducumentation." OFF)
|
option(DOCUMENTATION "Enable to generate ducumentation." OFF)
|
||||||
option(INTERNAL_DOC "Enable to generate internal & public documentaion. Disable to only generate public documentation" OFF)
|
option(INTERNAL_DOC "Enable to generate internal & public documentaion. Disable to only generate public documentation" OFF)
|
||||||
|
option(BUILD_EXAMPLES "Build tests." OFF)
|
||||||
|
|
||||||
# =============================================
|
# =============================================
|
||||||
# Policies
|
# Policies
|
||||||
|
@ -18,6 +20,7 @@ cmake_policy(SET CMP0076 NEW)
|
||||||
# =============================================
|
# =============================================
|
||||||
# Compiler
|
# Compiler
|
||||||
# =============================================
|
# =============================================
|
||||||
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # GNUCC
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # GNUCC
|
||||||
# Add linker options.
|
# Add linker options.
|
||||||
add_link_options(-nostdlib -nodefaultlibs -nostdinc -lgcc) # -z noexecstack
|
add_link_options(-nostdlib -nodefaultlibs -nostdinc -lgcc) # -z noexecstack
|
||||||
|
@ -39,25 +42,27 @@ endif()
|
||||||
# =============================================
|
# =============================================
|
||||||
# Directories
|
# Directories
|
||||||
# =============================================
|
# =============================================
|
||||||
set(PROJ_BUILD_DIR ${CMAKE_BINARY_DIR})
|
set(PROJ_BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/lib)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/lib)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/bin)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/bin)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJ_BUILD_DIR}/bin)
|
||||||
|
|
||||||
set(PROJ_REL_BUILD_DIR ${CMAKE_BINARY_DIR}/release)
|
set(PROJ_REL_BUILD_DIR ${PROJ_BUILD_DIR}/release)
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/lib)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/lib)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/bin)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/bin)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJ_REL_BUILD_DIR}/bin)
|
||||||
|
|
||||||
set(PROJ_DEB_BUILD_DIR ${CMAKE_BINARY_DIR}/debug)
|
set(PROJ_DEB_BUILD_DIR ${PROJ_BUILD_DIR}/debug)
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/lib)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/lib)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/bin)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/bin)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJ_DEB_BUILD_DIR}/bin)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(include)
|
add_subdirectory(include)
|
||||||
add_subdirectory(tests)
|
|
||||||
|
|
||||||
|
if (BUILD_EXAMPLES)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif(BUILD_EXAMPLES)
|
||||||
if (DOCUMENTATION)
|
if (DOCUMENTATION)
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
endif(DOCUMENTATION)
|
endif(DOCUMENTATION)
|
3
examples/CMakeLists.txt
Normal file
3
examples/CMakeLists.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# CMakeLists examples directory
|
||||||
|
|
||||||
|
add_subdirectory(HelloWorld)
|
BIN
examples/HelloWorld/hello
Executable file
BIN
examples/HelloWorld/hello
Executable file
Binary file not shown.
|
@ -1,3 +0,0 @@
|
||||||
# CMakeLists test directory
|
|
||||||
|
|
||||||
add_subdirectory(HelloWorld)
|
|
Loading…
Reference in New Issue
Block a user