diff --git a/src/libstp/CMakeLists.txt b/src/libstp/CMakeLists.txt index 83bd03a..9c0304b 100644 --- a/src/libstp/CMakeLists.txt +++ b/src/libstp/CMakeLists.txt @@ -23,6 +23,15 @@ set(stp_lib_targets printer ) +include_directories(${CMAKE_SOURCE_DIR}/src/AST/) +include_directories(${CMAKE_BINARY_DIR}/src/AST/) + +add_library(globalstp OBJECT + ../main/Globals.cpp + ${CMAKE_CURRENT_BINARY_DIR}/../main/GitSHA1.cpp +) +add_dependencies(globalstp ASTKind_header) + # Create list of objects and gather list of # associated public headers. set(stp_lib_objects "") @@ -31,6 +40,7 @@ foreach(target ${stp_lib_targets}) list(APPEND stp_lib_objects $) get_target_property(TARGETS_PUBLIC_HEADERS ${target} PUBLIC_HEADER) + set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON) if (EXISTS "${TARGETS_PUBLIC_HEADERS}") list(APPEND stp_public_headers "${TARGETS_PUBLIC_HEADERS}") message("Adding public header(s) ${TARGETS_PUBLIC_HEADERS} to target libstp") diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 0735137..73039f5 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -3,12 +3,6 @@ include_directories(${CMAKE_BINARY_DIR}/src/AST/) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp" @ONLY) -add_library(globalstp OBJECT - Globals.cpp - ${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp -) -add_dependencies(globalstp ASTKind_header) - # ----------------------------------------------------------------------------- # Create binary # -----------------------------------------------------------------------------