NKDBsec/third_party/io/cmake/SetCommon.cmake

41 lines
1.2 KiB
CMake
Raw Permalink Normal View History

2024-01-20 14:14:46 +08:00
# Global properties for Visual Studio folder
IF(MSVC)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
ENDIF()
# binaries and libraries output directory
IF(WIN32)
IF(CMAKE_CL_64)
SET(PLATDIR x64)
ELSE()
SET(PLATDIR Win32)
ENDIF()
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${PLATDIR})
ENDIF()
message(STATUS "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX})
# lib and bin
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/")
#message(STATUS "CMAKE_ARCHIVE_OUTPUT_DIRECTORY " ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
#message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY " ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
#message(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY " ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
link_directories(${CMAKE_BINARY_DIR}/lib)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
# default build type [is Release]
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
message(STATUS "CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE})
IF(${CMAKE_BUILD_TYPE} MATCHES Debug)
ADD_DEFINITIONS(-DDEBUG)
ELSE()
ADD_DEFINITIONS(-DNDEBUG)
ENDIF()