Skip to content

Commit

Permalink
[FIX] Build process shouldn’t modify source tree (#566)
Browse files Browse the repository at this point in the history
* [FIX] Build process shouldn’t modify source tree

* Update CMakeLists.txt

* Revert "Update CMakeLists.txt"

This reverts commit 557c098.
  • Loading branch information
codingforfun authored and hcho3 committed Sep 28, 2019
1 parent 8c74e08 commit 0f3ddbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ build
# CLion
.idea
cmake-build-*
/include/dmlc/build_config.h
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ set(DMLC_ENABLED_SANITIZERS "address" "leak" CACHE STRING
"Semicolon separated list of sanitizer names. E.g 'address;leak'. Supported sanitizers are
address, leak and thread.")

# include path
set(INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(INCLUDE_DMLC_DIR "${INCLUDE_ROOT}/dmlc")
# include_directories("${INCLUDE_ROOT}")

set(dmlccore_LINKER_LIBS "")

# Sanitizer
Expand Down Expand Up @@ -115,8 +110,8 @@ else()
set(DMLC_CMAKE_LITTLE_ENDIAN 1)
endif()

message(STATUS "${CMAKE_LOCAL}/build_config.h.in -> ${INCLUDE_DMLC_DIR}/build_config.h")
configure_file("${CMAKE_LOCAL}/build_config.h.in" "${INCLUDE_DMLC_DIR}/build_config.h")
message(STATUS "${CMAKE_LOCAL}/build_config.h.in -> include/dmlc/build_config.h")
configure_file("cmake/build_config.h.in" "include/dmlc/build_config.h")

# compiler flags
if(MSVC)
Expand Down Expand Up @@ -205,6 +200,7 @@ add_library(dmlc ${SOURCE})
target_link_libraries(dmlc ${dmlccore_LINKER_LIBS})
target_include_directories(dmlc PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
target_compile_definitions(dmlc PRIVATE -D_XOPEN_SOURCE=700
-D_POSIX_SOURCE -D_POSIX_C_SOURCE=200809L -D_DARWIN_C_SOURCE
Expand All @@ -215,6 +211,8 @@ include(GNUInstallDirs)
# ---[ Install Includes
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/dmlc
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/dmlc/build_config.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dmlc)

# ---[ Install the archive static lib and header files
install(TARGETS dmlc
Expand Down

0 comments on commit 0f3ddbc

Please sign in to comment.