1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 09:59:52 +03:00

CMake: don't hardcode build directories

Our CMake project used to forcefully create and use two different build directories: "build" and "tmp".

This commit changes the behavior so that only the build directory CMake is ran in is used.

The "configure" script now runs CMake in "build" by default, instead of "tmp".
This commit is contained in:
Davide Beatrici 2020-07-20 18:31:41 +02:00
parent 7b042e53d2
commit 369a8850c4
11 changed files with 22 additions and 36 deletions

View File

@ -6,7 +6,7 @@ project("SoftEther VPN"
)
set(TOP_DIRECTORY ${CMAKE_SOURCE_DIR})
set(BUILD_DIRECTORY ${TOP_DIRECTORY}/build)
set(BUILD_DIRECTORY ${CMAKE_BINARY_DIR})
# We define a dedicated variable because CMAKE_BUILD_TYPE can have different
# configurations than "Debug" and "Release", such as "RelWithDebInfo".

8
configure vendored
View File

@ -17,8 +17,8 @@ echo
echo 'Welcome to the corner-cutting configure script !'
echo
if [ ! -d "tmp" ]; then
mkdir tmp
if [ ! -d "build" ]; then
mkdir build
fi
if [ ! -z ${CMAKE_FLAGS+x} ]; then
@ -50,9 +50,9 @@ fi
echo ""
(cd tmp && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${CMAKE_FLAGS} .. || exit 1)
(cd build && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${CMAKE_FLAGS} .. || exit 1)
echo ""
echo "The Makefile is generated. Run 'make -C tmp' to build SoftEther VPN."
echo "The Makefile is generated. Run 'make -C build' to build SoftEther VPN."

View File

@ -13,11 +13,11 @@ echo.
echo Welcome to the corner-cutting configure script !
echo.
if not exist "tmp" (
mkdir tmp
if not exist "build" (
mkdir build
)
cd tmp
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "NMake Makefiles" ..

View File

@ -1,17 +1,3 @@
add_executable(hamcorebuilder hamcorebuilder.c)
set_target_properties(hamcorebuilder
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${TOP_DIRECTORY}/tmp"
LIBRARY_OUTPUT_DIRECTORY "${TOP_DIRECTORY}/tmp"
RUNTIME_OUTPUT_DIRECTORY "${TOP_DIRECTORY}/tmp"
)
if(WIN32)
set_target_properties(hamcorebuilder
PROPERTIES
PDB_OUTPUT_DIRECTORY "${TOP_DIRECTORY}/tmp"
)
endif()
target_link_libraries(hamcorebuilder cedar mayaqua)

View File

@ -19,8 +19,8 @@ if(WIN32)
get_filename_component(COMPONENT_FILE_NAME vpnbridge NAME)
set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_BINARY_DIR}/VerScript/vpnbridge.rc")
target_sources(vpnbridge PRIVATE vpnbridge.rc "${CMAKE_BINARY_DIR}/VerScript/vpnbridge.rc")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpnbridge PRIVATE "vpnbridge.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
endif()
target_link_libraries(vpnbridge cedar mayaqua)

View File

@ -19,8 +19,8 @@ if(WIN32)
get_filename_component(COMPONENT_FILE_NAME vpnclient NAME)
set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_BINARY_DIR}/VerScript/vpnclient.rc")
target_sources(vpnclient PRIVATE vpnclient.rc "${CMAKE_BINARY_DIR}/VerScript/vpnclient.rc")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpnclient PRIVATE "vpnclient.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
endif()
target_link_libraries(vpnclient cedar mayaqua)

View File

@ -19,8 +19,8 @@ if(WIN32)
get_filename_component(COMPONENT_FILE_NAME vpncmd NAME)
set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_BINARY_DIR}/VerScript/vpncmd.rc")
target_sources(vpncmd PRIVATE vpncmd.rc "${CMAKE_BINARY_DIR}/VerScript/vpncmd.rc")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpncmd PRIVATE "vpncmd.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
endif()
target_link_libraries(vpncmd cedar mayaqua)

View File

@ -10,8 +10,8 @@ add_executable(vpncmgr WIN32 vpncmgr.c vpncmgr.rc)
get_filename_component(COMPONENT_FILE_NAME vpncmgr NAME)
set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_BINARY_DIR}/VerScript/vpncmgr.rc")
target_sources(vpncmgr PRIVATE "${CMAKE_BINARY_DIR}/VerScript/vpncmgr.rc")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpncmgr PRIVATE "vpncmgr.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
target_sources(vpncmgr PRIVATE "${TOP_DIRECTORY}/src/BuildFiles/Manifests/x64_user.manifest")

View File

@ -19,8 +19,8 @@ if(WIN32)
get_filename_component(COMPONENT_FILE_NAME vpnserver NAME)
set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_BINARY_DIR}/VerScript/vpnserver.rc")
target_sources(vpnserver PRIVATE vpnserver.rc "${CMAKE_BINARY_DIR}/VerScript/vpnserver.rc")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpnserver PRIVATE "vpnserver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
endif()
target_link_libraries(vpnserver cedar mayaqua)

View File

@ -10,8 +10,8 @@ add_executable(vpnsmgr WIN32 vpnsmgr.c vpnsmgr.rc)
get_filename_component(COMPONENT_FILE_NAME vpnsmgr NAME)
set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_BINARY_DIR}/VerScript/vpnsmgr.rc")
target_sources(vpnsmgr PRIVATE "${CMAKE_BINARY_DIR}/VerScript/vpnsmgr.rc")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpnsmgr PRIVATE "vpnsmgr.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
target_sources(vpnsmgr PRIVATE "${TOP_DIRECTORY}/src/BuildFiles/Manifests/x64_user.manifest")

View File

@ -19,8 +19,8 @@ if(WIN32)
get_filename_component(COMPONENT_FILE_NAME vpntest NAME)
set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_BINARY_DIR}/VerScript/vpntest.rc")
target_sources(vpntest PRIVATE vpntest.rc "${CMAKE_BINARY_DIR}/VerScript/vpntest.rc")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpntest PRIVATE "vpntest.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
target_sources(vpntest PRIVATE "${TOP_DIRECTORY}/src/BuildFiles/Manifests/x64_user.manifest")