TODO fixed
This commit is contained in:
parent
4d247b7ae2
commit
71b02c632b
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,8 +1,2 @@
|
||||
compile/*
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
cmake_install.cmake
|
||||
Makefile
|
||||
compiler
|
||||
bin
|
||||
build/*
|
||||
build
|
@ -7,6 +7,11 @@ project(main VERSION 1.0.0 HOMEPAGE_URL "https://git.noorlander.info/E.Noorlande
|
||||
# Set a custom application name and definitions
|
||||
set(BIN_NAME "test")
|
||||
add_compile_definitions(APP_NAME="${BIN_NAME}")
|
||||
add_compile_definitions(MESSAGE="Hello for TESTLIB from cmake.")
|
||||
add_compile_definitions(MAIN_MESSAGE="Hello for main.c from cmake.")
|
||||
|
||||
# set 1 to compile static (Standalone)
|
||||
set(BIN_STATIC 1)
|
||||
|
||||
# Set binary suffix based on the operating system
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
@ -34,10 +39,6 @@ set(SubProjects
|
||||
# Create the main executable, specifying the source file
|
||||
add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c)
|
||||
|
||||
# Set some application definitions
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC MESSAGE="Hello for TESTLIB from cmake.") #TODO String don't pass to .c file
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC MAIN_MESSAGE="Hello for main.c from cmake.") #TODO String don't pass to .c file
|
||||
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${BIN_NAME}
|
||||
@ -53,5 +54,9 @@ foreach(Project IN LISTS SubProjects)
|
||||
endif()
|
||||
|
||||
# Link the subproject to the main project executable
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${Project})
|
||||
if(BIN_STATIC)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${Project} -static)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${Project})
|
||||
endif()
|
||||
endforeach()
|
Loading…
x
Reference in New Issue
Block a user