@@ -85,21 +85,22 @@ endforeach()
8585
8686# Helper function to prompt user for input
8787function (prompt_user PROMPT_TEXT OUTPUT_VAR DEFAULT_VALUE )
88+ # Display prompt using CMake message (goes to console)
89+ execute_process (COMMAND ${CMAKE_COMMAND} -E echo_append "${PROMPT_TEXT} " )
90+
8891 if (CMAKE_HOST_WIN32 )
8992 # Windows: Use PowerShell for input
9093 execute_process (
91- COMMAND powershell -NoProfile -Command "Write-Host -NoNewline ' ${PROMPT_TEXT} '; Read- Host"
94+ COMMAND powershell -NoProfile -Command "$ Host.UI.ReadLine() "
9295 OUTPUT_VARIABLE USER_INPUT
9396 OUTPUT_STRIP_TRAILING_WHITESPACE
94- ERROR_QUIET
9597 )
9698 else ()
97- # Unix: Use bash/sh for input
99+ # Unix: Read from stdin using shell
98100 execute_process (
99- COMMAND bash -c "read -p ' ${PROMPT_TEXT} ' input && echo -n \" $input\" "
101+ COMMAND sh -c "read input && printf '%s' \" $input\" "
100102 OUTPUT_VARIABLE USER_INPUT
101103 OUTPUT_STRIP_TRAILING_WHITESPACE
102- ERROR_QUIET
103104 )
104105 endif ()
105106
@@ -177,8 +178,23 @@ message("Include examples: ${ARG_EXAMPLES}")
177178message ("Include tests: ${ARG_TESTS} " )
178179message ("" )
179180
180- # Create project directory
181- set (PROJECT_DIR "${CMAKE_CURRENT_LIST_DIR} /${ARG_NAME} " )
181+ # Get current working directory
182+ if (CMAKE_HOST_WIN32 )
183+ execute_process (
184+ COMMAND powershell -NoProfile -Command "Get-Location | Select-Object -ExpandProperty Path"
185+ OUTPUT_VARIABLE CURRENT_DIR
186+ OUTPUT_STRIP_TRAILING_WHITESPACE
187+ )
188+ else ()
189+ execute_process (
190+ COMMAND pwd
191+ OUTPUT_VARIABLE CURRENT_DIR
192+ OUTPUT_STRIP_TRAILING_WHITESPACE
193+ )
194+ endif ()
195+
196+ # Create project directory in current working directory
197+ set (PROJECT_DIR "${CURRENT_DIR} /${ARG_NAME} " )
182198if (EXISTS "${PROJECT_DIR} " )
183199 message (FATAL_ERROR "Directory '${ARG_NAME} ' already exists!" )
184200endif ()
@@ -365,10 +381,13 @@ message("\n=== Setup Complete! ===\n")
365381message ("Your library has been created in: ${ARG_NAME} /" )
366382message ("\n Next steps:" )
367383message (" cd ${ARG_NAME} " )
384+ message ("\n # Generate template files (CMakePresets.json, CI workflows, etc.)" )
385+ message (" cmake -B build -DCPP_LIBRARY_FORCE_INIT=ON" )
386+ message ("\n # Now you can use the presets:" )
368387message (" cmake --preset=test" )
369388message (" cmake --build --preset=test" )
370389message (" ctest --preset=test" )
371- message ("\n To regenerate template files (CMakePresets.json, CI workflows) :" )
390+ message ("\n To regenerate template files later :" )
372391message (" cmake --preset=init" )
373392message (" cmake --build --preset=init" )
374393message ("\n For more information, visit: https://github.com/stlab/cpp-library" )
0 commit comments