TODO fixed
This commit is contained in:
parent
4d247b7ae2
commit
71b02c632b
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,8 +1,2 @@
|
|||||||
compile/*
|
build/*
|
||||||
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 a custom application name and definitions
|
||||||
set(BIN_NAME "test")
|
set(BIN_NAME "test")
|
||||||
add_compile_definitions(APP_NAME="${BIN_NAME}")
|
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
|
# Set binary suffix based on the operating system
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
@ -34,10 +39,6 @@ set(SubProjects
|
|||||||
# Create the main executable, specifying the source file
|
# Create the main executable, specifying the source file
|
||||||
add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c)
|
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}
|
set_target_properties(${PROJECT_NAME}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
OUTPUT_NAME ${BIN_NAME}
|
OUTPUT_NAME ${BIN_NAME}
|
||||||
@ -53,5 +54,9 @@ foreach(Project IN LISTS SubProjects)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Link the subproject to the main project executable
|
# 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()
|
endforeach()
|
Loading…
x
Reference in New Issue
Block a user