Skip to content

Commit

Permalink
Put targets on folders, if the IDE supports the feature.
Browse files Browse the repository at this point in the history
Requires CMake 2.8.3 or newer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126092 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Oscar Fuentes committed Feb 20, 2011
1 parent f7ad048 commit 0b85d07
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set(CMAKE_MODULE_PATH

set(PACKAGE_VERSION "2.9")

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(VersionFromVCS)

option(LLVM_APPEND_VC_REV
Expand Down
12 changes: 12 additions & 0 deletions cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ macro(add_llvm_library name)
if( CURRENT_LLVM_TARGET )
add_dependencies(${name} ${CURRENT_LLVM_TARGET})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
endmacro(add_llvm_library name)


Expand Down Expand Up @@ -55,6 +56,8 @@ ${name} ignored.")
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()

set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
endmacro(add_llvm_loadable_module name)


Expand Down Expand Up @@ -95,6 +98,7 @@ macro(add_llvm_tool name)
if( LLVM_BUILD_TOOLS )
install(TARGETS ${name} RUNTIME DESTINATION bin)
endif()
set_target_properties(${name} PROPERTIES FOLDER "Tools")
endmacro(add_llvm_tool name)


Expand All @@ -107,9 +111,16 @@ macro(add_llvm_example name)
if( LLVM_BUILD_EXAMPLES )
install(TARGETS ${name} RUNTIME DESTINATION examples)
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endmacro(add_llvm_example name)


macro(add_llvm_utility name)
add_llvm_executable(${name} ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "Utils")
endmacro(add_llvm_utility name)


macro(add_llvm_target target_name)
if( TABLEGEN_OUTPUT )
add_custom_target(${target_name}Table_gen
Expand All @@ -120,6 +131,7 @@ macro(add_llvm_target target_name)
add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
if ( TABLEGEN_OUTPUT )
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
set_target_properties(${target_name}Table_gen PROPERTIES FOLDER "Tablegenning")
endif (TABLEGEN_OUTPUT)
set( CURRENT_LLVM_TARGET LLVM${target_name} )
endmacro(add_llvm_target)
2 changes: 2 additions & 0 deletions include/llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tablegen(Intrinsics.gen -gen-intrinsic)

add_custom_target(intrinsics_gen ALL
DEPENDS ${llvm_builded_incs_dir}/Intrinsics.gen)
set_target_properties(intrinsics_gen PROPERTIES FOLDER "Tablegenning")

set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} intrinsics_gen PARENT_SCOPE)

Expand All @@ -16,4 +17,5 @@ if( MSVC_IDE OR XCODE )
# We need at least one source file:
${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello/Hello.cpp
${headers})
set_target_properties(llvm_headers_do_not_build PROPERTIES FOLDER "Misc")
endif()
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ if(PYTHONINTERP_FOUND)
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running LLVM regression tests")
set_target_properties(check PROPERTIES FOLDER "Tests")

add_custom_target(check.deps)
add_dependencies(check check.deps)
Expand All @@ -91,5 +92,6 @@ if(PYTHONINTERP_FOUND)
llc lli llvm-ar llvm-as llvm-dis llvm-extract
llvm-ld llvm-link llvm-mc llvm-nm macho-dump opt
FileCheck count not)
set_target_properties(check.deps PROPERTIES FOLDER "Tests")

endif()
2 changes: 2 additions & 0 deletions unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ function(add_llvm_unittest test_dirname)
endif()
add_llvm_executable(${test_name}Tests ${ARGN})
add_dependencies(UnitTests ${test_name}Tests)
set_target_properties(${test_name}Tests PROPERTIES FOLDER "Tests")
endfunction()

add_custom_target(UnitTests)
set_target_properties(UnitTests PROPERTIES FOLDER "Tests")

include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
add_definitions(-DGTEST_HAS_RTTI=0)
Expand Down
2 changes: 1 addition & 1 deletion utils/FileCheck/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(FileCheck
add_llvm_utility(FileCheck
FileCheck.cpp
)

Expand Down
2 changes: 1 addition & 1 deletion utils/FileUpdate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(FileUpdate
add_llvm_utility(FileUpdate
FileUpdate.cpp
)

Expand Down
2 changes: 1 addition & 1 deletion utils/KillTheDoctor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(KillTheDoctor
add_llvm_utility(KillTheDoctor
KillTheDoctor.cpp
)

Expand Down
2 changes: 1 addition & 1 deletion utils/TableGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(LLVM_REQUIRES_RTTI 1)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})

add_executable(tblgen
add_llvm_utility(tblgen
ARMDecoderEmitter.cpp
AsmMatcherEmitter.cpp
AsmWriterEmitter.cpp
Expand Down
2 changes: 1 addition & 1 deletion utils/count/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(count
add_llvm_utility(count
count.c
)
2 changes: 1 addition & 1 deletion utils/not/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(not
add_llvm_utility(not
not.cpp
)

Expand Down

0 comments on commit 0b85d07

Please sign in to comment.