SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
### Compute the include paths
-set(INCLUDES
+
+# Only include public headers by default
+include_directories(
+ ${CMAKE_BINARY_DIR}/include
+ ${CMAKE_HOME_DIRECTORY}/include
+)
+
+# Compute the ones that should be added when compiling the library
+set(INTERNAL_INCLUDES
${CMAKE_BINARY_DIR}
- ${CMAKE_BINARY_DIR}/include
${CMAKE_HOME_DIRECTORY}
- ${CMAKE_HOME_DIRECTORY}/include
${CMAKE_HOME_DIRECTORY}/src/include
)
if(enable_smpi)
- set (INCLUDES ${INCLUDES} ${CMAKE_HOME_DIRECTORY}/src/smpi/include)
+ set (INTERNAL_INCLUDES ${INTERNAL_INCLUDES} ${CMAKE_HOME_DIRECTORY}/src/smpi/include)
endif()
if(NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/include/)
- set(INCLUDES ${INCLUDES} /usr/include/)
+ set(INTERNAL_INCLUDES ${INTERNAL_INCLUDES} /usr/include/)
endif()
if(WIN32)
set(CMAKE_LIB_WIN "${CMAKE_C_COMPILER}")
string(REGEX REPLACE "/bin/gcc.*" "/include" CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
string(REGEX REPLACE "/bin/gcc.*" "/lib" CMAKE_LIB_WIN "${CMAKE_LIB_WIN}")
- set(INCLUDES ${INCLUDES} ${CMAKE_INCLUDE_WIN})
+ set(INTERNAL_INCLUDES ${INTERNAL_INCLUDES} ${CMAKE_INCLUDE_WIN})
unset(CMAKE_INCLUDE_WIN)
endif()
-include_directories(${INCLUDES})
-
# library dependency cannot start with a space (CMP0004), so initialize it with something that is never desactivated.
set(SIMGRID_DEP "-lm")
-/* Copyright (c) 2010-2018. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
add_executable (${x} ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+ set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
endif()
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
add_executable (${x} ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+ set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
add_executable (${x} ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+ set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
add_executable (maxmin_bench maxmin_bench/maxmin_bench.cpp)
target_link_libraries(maxmin_bench simgrid)
set_target_properties(maxmin_bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/maxmin_bench)
+set_property(TARGET maxmin_bench APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
foreach(x small medium large)
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/maxmin_bench/maxmin_bench_${x}.tesh)
add_executable (${x} ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+ set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
if(HAVE_MMALLOC)
add_executable (mmalloc_test ${CMAKE_CURRENT_SOURCE_DIR}/mmalloc/mmalloc_test.cpp)
target_link_libraries(mmalloc_test simgrid)
- set_target_properties(mmalloc_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mmalloc)
+ set_target_properties(mmalloc_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mmalloc)
+ set_property(TARGET mmalloc_test APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
endif()
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/log_usage/log_usage_ndebug.tesh
add_library(simgrid-java SHARED ${JMSG_C_SRC})
set_target_properties(simgrid-java PROPERTIES VERSION ${libsimgrid-java_version})
set_target_properties(simgrid-java PROPERTIES SKIP_BUILD_RPATH ON)
+set_property(TARGET simgrid-java
+ APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
target_link_libraries(simgrid-java simgrid)
# Actually declare our libraries
add_library(simgrid SHARED ${simgrid_sources})
set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
+# The library can obviously use the internal headers
+set_property(TARGET simgrid
+ APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
add_dependencies(simgrid maintainer_files)
add_executable(simgrid-mc ${MC_SIMGRID_MC_SRC})
target_link_libraries(simgrid-mc simgrid)
set_target_properties(simgrid-mc
- PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+ PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+ set_property(TARGET simgrid-mc
+ APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
+
endif()
+
# Compute the dependencies of SimGrid
#####################################
if (HAVE_BOOST_CONTEXTS)
add_executable (unit_tmgr src/surf/trace_mgr_test.cpp)
target_link_libraries(unit_tmgr simgrid ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
ADD_TEST(unit_tmgr ${CMAKE_BINARY_DIR}/unit_tmgr --build_info=yes)
+ set_property(
+ TARGET unit_tmgr
+ APPEND PROPERTY
+ INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}"
+ )
+
else()
set(EXTRA_DIST ${EXTRA_DIST} src/surf/trace_mgr_test.cpp)
add_executable (testall ${EXTRACTED_TEST_SOURCE_FILES})
target_link_libraries(testall simgrid)
+set_property(
+ TARGET testall
+ APPEND PROPERTY
+ INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}"
+ )