Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goal:Allow someone that uses the cmake_template to have a single varaible file to add exec, sub dirs, and vscode project default #47

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ endif()
# when compiling with PCH enabled
set(CMAKE_CXX_EXTENSIONS OFF)

include(project_variables.cmake)

# Set the project name and language
project(
myproject
Expand Down Expand Up @@ -92,7 +94,8 @@ if(MSVC)
endif()

# set the startup project for the "play" button in MSVC
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT intro)
#set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT intro)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${DEFAULT_EXEC})

if(CMAKE_SKIP_INSTALL_RULES)
return()
Expand All @@ -104,7 +107,7 @@ include(cmake/PackageProject.cmake)
# we know we want to ship
myproject_package_project(
TARGETS
intro
${PROJ_EXEC1}
myproject_options
myproject_warnings
# FIXME: this does not work! CK
Expand Down
11 changes: 11 additions & 0 deletions project_variables.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set(PROJ_EXEC1 "intro")

#directories under src that will be added as subdirectories to the project
set(MY_PROJECT_SUBDIRECTORIES "ftxui_sample;sample_library")

set(DEFAULT_EXEC ${PROJ_EXEC1} CACHE STRING "Default executable to build")

#set(MY_PROJECT_TARGETS "${PROJ_EXEC1} ${SERVER_APP}")
set(MY_PROJECT_TARGETS "${PROJ_EXEC1}")

MESSAGE(STATUS "MY PROJECT TARGETS = ${MY_PROJECT_TARGETS}")
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
add_subdirectory(sample_library)
add_subdirectory(ftxui_sample)
foreach(d ${MY_PROJECT_SUBDIRECTORIES})
MESSAGE(STATUS "Adding subdirectory: ${d}")
add_subdirectory(${d})
endforeach()